本文主要介绍使用Java kotlin报错:The minCompileSdk (31) 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.core:core-ktx:1.7.0-alpha02. 的解决方法。

报错信息:

The minCompileSdk (31) 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.core:core-ktx:1.7.0-alpha02. AAR metadata file: C:\Users\mohammad.zeeshan1.gradle\caches\transforms-2\files-2.1\a20beb0771f59a8ddbbb8d416ea06a9d\jetified-core-ktx-1.7.0-alpha02\META-INF\com\android\build\gradle\aar-metadata.properties.

解决方法:

在 APP的Gradle文件的package中输入如下代码:

configurations.all {
resolutionStrategy { force 'androidx.core:core-ktx:1.6.0' }
}

在配置文件中的位置如下图:

httpswwwcjavapycom

或者

build.gradle(app) 文件中添加compileSdkVersion 31 和 targetSdkVersion 31,具体如下,

android {
compileSdkVersion 31
defaultConfig {
applicationId "com.example.app"
targetSdkVersion 31
// ...
}
}

推荐文档

相关文档

大家感兴趣的内容

随机列表