The minCompileSdk (32) specified in adependency‘s AAR metadata (META-INF/com/android/build/gradle...

文章描述了一个在升级AndroidStudio后遇到的编译错误,错误源于依赖库的minCompileSdk值高于项目的compileSdkVersion。解决方案是通过检查和调整依赖库版本,特别是com.google.android.material:material:1.6.0版本,以确保所有依赖的最低编译SDK版本与项目兼容。
摘要由CSDN通过智能技术生成

报错背景:升级了androidstudio跑老项目...

One or more issues found when checking AAR metadata values:

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-31).
Dependency: androidx.appcompat:appcompat-resources:1.5.0.
AAR metadata file: /Users/zhoumohan/.gradle/caches/transforms-3/ce5ad7dcd44ee111145f9d367555bc51/transformed/jetified-appcompat-resources-1.5.0/META-INF/com/android/build/gradle/aar-metadata.properties.

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-31).
Dependency: androidx.appcompat:appcompat:1.5.0.
AAR metadata file: /Users/zhoumohan/.gradle/caches/transforms-3/aa673e4f21bf06a2e2bbbc57fe94476c/transformed/appcompat-1.5.0/META-INF/com/android/build/gradle/aar-metadata.properties.

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-31).
Dependency: androidx.emoji2:emoji2-views-helper:1.2.0.
AAR metadata file: /Users/zhoumohan/.gradle/caches/transforms-3/a1957b24a87b1ec42d5bbbbaff2bb7d9/transformed/jetified-emoji2-views-helper-1.2.0/META-INF/com/android/build/gradle/aar-metadata.properties.

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-31).
Dependency: androidx.emoji2:emoji2:1.2.0.
AAR metadata file: /Users/zhoumohan/.gradle/caches/transforms-3/5aebafefd35c9be2c9d4ad40531fb71a/transformed/jetified-emoji2-1.2.0/META-INF/com/android/build/gradle/aar-metadata.properties.

线索1:

/Users/zhoumohan/.gradle/caches/transforms-3/ce5ad7dcd44ee111145f9d367555bc51/transformed/jetified-appcompat-resources-1.5.0/META-INF/com/android/build/gradle/aar-metadata.properties.

查看这个文件:

aarFormatVersion=1.0
aarMetadataVersion=1.0
minCompileSdk=32  //最小CompileSdk是32,而我的是30,不符合规则
minCompileSdkExtension=0
minAndroidGradlePluginVersion=1.0.0

线索2:

Dependency: androidx.appcompat:appcompat-resources:1.5.0.

结合线索1就是,想要依赖 androidx.appcompat:appcompat-resources:1.5.0.,compilesdk必须大于等于32,那我们猜想把这个库的版本降低应该就能解决问题,但全局搜索发现我们自己并没有直接依赖这个库,所以我们使用as自带的工具查看依赖关系:

 

最终发现是

'com.google.android.material:material:1.6.0'

中依赖

androidx.appcompat:appcompat-resources:1.5.0.

导致的问题,所以降低material的版本直到符合编译检查。

同理,可以按照此方法逐个排查此类问题。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值