The minCompileSdk (31) specified in a dependency’s AAR metadata is greater than this module’s compileSdkVersion (android-30)
编译Android项目时报如下异常:
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.work:work-runtime:2.7.0. AAR metadata file: C:\Users\apple\.gradle\caches\transforms-2\files-2.1\6c76dd4d08c29e06352d567fc539f8a4\work-runtime-2.7.0\META-INF\com\android\build\gradle\aar-metadata.properties.
解决方法就是将 compileSdk 和 targetSdk 都由 30 改为 31或者在build.gradle添加如下configurations.all部分的配置:
defaultConfig { configurations.all { resolutionStrategy { force 'androidx.core:core-ktx:1.6.0' } } applicationId "com.xxx.app" minSdkVersion 21 targetSdkVersion 30 versionCode 1 versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" }
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。