随笔 - 245  文章 - 0  评论 - 11  阅读 - 50万

Android Studio 编译报错 The minCompileSdk (33) specified in a dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)

在AS上新建了一个项目,默认的开发语言是kotlin,当项目加载完成后,发现无法编译,并报出如下错误:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
One or more issues found when checking AAR metadata values:
 
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-32).
Dependency: androidx.core:core:1.9.0.
AAR metadata file: D:\gradle-6.7.1\caches\transforms-3\9f4322093e90d7f81018947ba38ee02c\transformed\core-1.9.0\META-INF\com\android\build\gradle\aar-metadata.properties.
 
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-32).
Dependency: androidx.core:core-ktx:1.9.0.
AAR metadata file: D:\gradle-6.7.1\caches\transforms-3\48a46785e59c8f4cdfb9c23472b265a8\transformed\jetified-core-ktx-1.9.0\META-INF\com\android\build\gradle\aar-metadata.properties.
 
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-32).
Dependency: androidx.annotation:annotation-experimental:1.3.0.
AAR metadata file: D:\gradle-6.7.1\caches\transforms-3\68d799915626af8284fc012c9590c9cd\transformed\jetified-annotation-experimental-1.3.0\META-INF\com\android\build\gradle\aar-metadata.properties.

如图:

 

 

1
2
3
4
5
6
7
8
9
10
We recommend using a newer Android Gradle plugin to use compileSdk = 32
 
This Android Gradle plugin (7.0.3) was tested up to compileSdk = 31
 
This warning can be suppressed by adding
    android.suppressUnsupportedCompileSdk=32
to this project's gradle.properties
 
The build will continue, but you are strongly encouraged to update your project to
use a newer Android Gradle Plugin that has been tested with compileSdk = 32

  如图:

 

 解决:
这边报错原因是’androidx.appcompat:appcompat:1.5.1’ 版本过高,在此降低依赖库的版本即可,使用’androidx.appcompat:appcompat:1.0.0’,这样“Sync now”后,代码上的红色下划线便消失了。

现在的版本:

1
2
3
4
5
6
7
implementation 'androidx.core:core-ktx:1.9.0'
    implementation 'androidx.appcompat:appcompat:1.5.1'
    implementation 'com.google.android.material:material:1.6.1'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

 

我直接用的以前项目的版本

1
2
3
4
5
6
7
implementation 'androidx.appcompat:appcompat:1.4.1'
   implementation 'com.google.android.material:material:1.5.0'
   implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
   implementation 'org.jetbrains:annotations:15.0'
   testImplementation 'junit:junit:4.+'
   androidTestImplementation 'androidx.test.ext:junit:1.1.3'
   androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

  再次编译,OK,可以正常编译

 

参考:https://blog.csdn.net/qq_39994562/article/details/126744988

posted on   巫山老妖  阅读(10733)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· Vue3状态管理终极指南:Pinia保姆级教程
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示