Android Studio: This file not part of the project, but the project builds successfully

前端 未结 5 466
后悔当初
后悔当初 2021-01-13 20:03

I have a strange problem that suddenly appeared in android studio. I created a new cpp file, and included it in Android.mk. Then I synced the project. However, android studi

5条回答
  •  伪装坚强ぢ
    2021-01-13 20:40

    I have similar problem, it could be the compatibility issue of gradle version and gradle plugin version, because my solution is replacing the old configuration

    // build.gradle
    classpath 'com.android.tools.build:gradle:3.2.1'
    ...
    // gradle-wrapper.properties
    distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
    

    with the following new one by changing gradle version from 4.6 to 4.10.1.

    // build.gradle
    classpath 'com.android.tools.build:gradle:3.2.1'
    ...
    // gradle-wrapper.properties
    distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
    

    After that, Android studio can index and track my new cpp files in project.

提交回复
热议问题