Java kotlin报错The minCompileSdk (33) specified in a dependency’s AAR metadata解决方法

使用kotlin报错:

The minCompileSdk (33) specified in a
dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
is greater than this module's compileSdkVersion (android-31).
Dependency: androidx.core:core-ktx:1.9.0-beta01.
AAR metadata file: C:\Users\apple\.gradle\caches\transforms-2\files-2.1\ab31a5a89015ab46b71f84e97bec3cde\core-ktx-1.9.0-beta01\META-INF\com\android\build\gradle\aar-metadata.properties.

解决方法:

在 app的build.gradle文件的defaultConfig中输入configurations.all代码,如下所示:

configurations.all { resolutionStrategy { force 'androidx.core:core-ktx:1.9.0-beta01' }defaultConfig {
    configurations.all {
        resolutionStrategy { force 'androidx.core:core-ktx:1.9.0-beta01.' }
    }
    minSdkVersion 19
    targetSdkVersion 31
    versionCode 1
    versionName "1.0"

    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    consumerProguardFiles "consumer-rules.pro"
}

 

发表回复

后才能评论