Android studio build error Could not create task ':app:generateLintModuleInfo'.

Reason: Create a brand new project and only import a third-party library. It always fails to build.

1. First report the error The minCompileSdk (32) specified in dependency's AAR metadata

The minCompileSdk (32) specified in a
dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
is greater than this module's compileSdkVersion (android-30).
Dependency: androidx.appcompat:appcompat-resources:1.5.0.
AAR metadata file: C:\Users\Administrator\.gradle\caches\transforms-2\files-2.1\ed38fc20150a0efa817c1962a16dbde0\appcompat-resources-1.5.0\META-INF\com\android\build\gradle\aar-metadata.properties.

I think it is because the build.gradle of the tripartite library and the project configuration are inconsistent, so modify the project configuration to 32

    compileSdkVersion 32
    buildToolsVersion "32.0.0"

    defaultConfig {
        applicationId "com.me.test"
        minSdkVersion 21
        targetSdkVersion 32
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

Second, rebuild, unsuccessful. Error Could not create task ':app:generateLintModuleInfo'.

Could not create task ':app:generateLintModuleInfo'.
Cannot query the value of this provider because it has no value available.

Search the solution on the Internet, it is said that in the project mode, find the gradle.xml file in the .idea folder, and in the <GradleProjectSettings> node, modify the value of value from true to false.

3. After modifying to false, build, and a new error appears Installed Build Tools revision 32.0.0 is corrupted. Remove and install again using the SDK Manager.

 Installed Build Tools revision 32.0.0 is corrupted. Remove and install again using the SDK Manager.

The problem is to find the sdk path, usually on the c drive. Copy core-lambda-stubs.jar to the above lib folder and rename it to dx.jar.

Rebuild, success.

@@Later, I changed the false in the .idea file of the second step back to true. The same can be built successfully. So it should be that I didn't understand the reason for the error, that is not the root cause, no modification is needed, just do the third step.

おすすめ

転載: blog.csdn.net/aianzxy/article/details/129590484