文章详情

短信预约-IT技能 免费直播动态提醒

请输入下面的图形验证码

提交验证

短信预约提醒成功

【错误记录】Android Studio 编译报错 ( The minCompileSdk (33) specified in a dependency‘s AAR metadata META-I )

2023-08-21 08:16

关注




一、报错信息



Android Studio 编译时 , 报如下错误 :

Execution failed for task ':core:checkDebugAarMetadata'.> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction   > 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: C:\Users\octop\.gradle\caches\transforms-2\files-2.1\c6e343978c6a27069301c93169f4abc4\core-1.9.0\META-INF\com\android\build\gradle\aar-metadata.properties.* Try:Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

在这里插入图片描述





二、解决方案



方案一 : 修改编译版本

方法一 : 直接修改编译版本 ;

问题是 androidx.core:core:1.9.0. 依赖库中 要求的 minCompileSdk 为 33 , 本应用的编译版本为 32 , 这里设置为 33 即可解决 , 但是这样设置会造成其它问题 ;

android {    compileSdkVersion 32    buildToolsVersion "32.0.0"    defaultConfig {        applicationId "kim.hsl.core"        minSdkVersion 18        targetSdkVersion 32        versionCode 1        versionName "1.0"        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"    }}

方案二 : 处理依赖库


下面从依赖分析的角度解决上述问题 ;

执行

gradlew app:dependencies --configuration releaseRuntimeClasspath

命令 , 查看依赖库 , 输入内容如下 :

D:\002_Project\002_Android_Learn\Componentization>gradlew app:dependencies --configuration releaseRuntimeClasspathWARNING:: Please remove usages of `jcenter()` Maven repository from your build scripts and migrate your build to other Maven repositories.This repository is deprecated and it will be shut down in the future.See http://developer.android.com/r/tools/jcenter-end-of-service for more information.Currently detected usages in: root project 'Componentization', project ':app', project ':base', ...> Task :app:dependencies------------------------------------------------------------Project :app------------------------------------------------------------releaseRuntimeClasspath - Runtime classpath of compilation 'release' (target  (androidJvm)).+--- org.jetbrains.kotlin:kotlin-stdlib:1.5.0 -> 1.7.10|    +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.7.10|    \--- org.jetbrains:annotations:13.0+--- androidx.core:core-ktx:1.9.0|    +--- androidx.annotation:annotation:1.1.0 -> 1.3.0|    +--- androidx.core:core:1.9.0|    |    +--- androidx.annotation:annotation:1.2.0 -> 1.3.0|    |    +--- androidx.annotation:annotation-experimental:1.3.0|    |    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.7.10 (*)|    |    +--- androidx.collection:collection:1.0.0 -> 1.1.0|    |    |    \--- androidx.annotation:annotation:1.1.0 -> 1.3.0|    |    +--- androidx.concurrent:concurrent-futures:1.0.0|    |    |    +--- com.google.guava:listenablefuture:1.0|    |    |    \--- androidx.annotation:annotation:1.1.0 -> 1.3.0|    |    +--- androidx.lifecycle:lifecycle-runtime:2.3.1 -> 2.5.1|    |    |    +--- androidx.annotation:annotation:1.1.0 -> 1.3.0|    |    |    +--- androidx.arch.core:core-common:2.1.0|    |    |    |    \--- androidx.annotation:annotation:1.1.0 -> 1.3.0|    |    |    +--- androidx.arch.core:core-runtime:2.1.0|    |    |    |    +--- androidx.annotation:annotation:1.1.0 -> 1.3.0|    |    |    |    \--- androidx.arch.core:core-common:2.1.0 (*)|    |    |    \--- androidx.lifecycle:lifecycle-common:2.5.1|    |    |         \--- androidx.annotation:annotation:1.1.0 -> 1.3.0|    |    +--- androidx.versionedparcelable:versionedparcelable:1.1.1|    |    |    +--- androidx.annotation:annotation:1.1.0 -> 1.3.0|    |    |    \--- androidx.collection:collection:1.0.0 -> 1.1.0 (*)|    |    \--- androidx.core:core-ktx:1.9.0 (c)|    +--- org.jetbrains.kotlin:kotlin-stdlib:1.7.10 (*)|    \--- androidx.core:core:1.9.0 (c)+--- androidx.appcompat:appcompat:1.5.1|    +--- androidx.activity:activity:1.5.1|    |    +--- androidx.annotation:annotation:1.1.0 -> 1.3.0|    |    +--- androidx.collection:collection:1.0.0 -> 1.1.0 (*)|    |    +--- androidx.core:core:1.8.0 -> 1.9.0 (*)|    |    +--- androidx.lifecycle:lifecycle-runtime:2.5.1 (*)|    |    +--- androidx.lifecycle:lifecycle-viewmodel:2.5.1|    |    |    +--- androidx.annotation:annotation:1.1.0 -> 1.3.0|    |    |    +--- org.jetbrains.kotlin:kotlin-stdlib:1.6.21 -> 1.7.10 (*)|    |    |    \--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.5.1 (c)|    |    +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.5.1|    |    |    +--- androidx.annotation:annotation:1.0.0 -> 1.3.0|    |    |    +--- androidx.core:core-ktx:1.2.0 -> 1.9.0 (*)|    |    |    +--- androidx.lifecycle:lifecycle-livedata-core:2.5.1|    |    |    |    +--- androidx.arch.core:core-common:2.1.0 (*)|    |    |    |    +--- androidx.arch.core:core-runtime:2.1.0 (*)|    |    |    |    \--- androidx.lifecycle:lifecycle-common:2.5.1 (*)|    |    |    +--- androidx.lifecycle:lifecycle-viewmodel:2.5.1 (*)|    |    |    +--- androidx.savedstate:savedstate:1.2.0|    |    |    |    +--- androidx.annotation:annotation:1.1.0 -> 1.3.0|    |    |    |    +--- androidx.arch.core:core-common:2.1.0 (*)|    |    |    |    +--- androidx.lifecycle:lifecycle-common:2.4.0 -> 2.5.1 (*)|    |    |    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.6.20 -> 1.7.10 (*)|    |    |    +--- org.jetbrains.kotlin:kotlin-stdlib:1.6.21 -> 1.7.10 (*)|    |    |    \--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.1|    |    |         +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.1|    |    |         |    \--- org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.6.1|    |    |         |         +--- org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.6.1|    |    |         |         |    +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.1 (c)|    |    |         |         |    +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.1 (c)|    |    |         |         |    \--- org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.6.1 (c)|    |    |         |         +--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.0|    |    |         |         |    +--- org.jetbrains.kotlin:kotlin-stdlib:1.6.0 -> 1.7.10 (*)|    |    |         |         |    \--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.0|    |    |         |         |         \--- org.jetbrains.kotlin:kotlin-stdlib:1.6.0 -> 1.7.10 (*)|    |    |         |         \--- org.jetbrains.kotlin:kotlin-stdlib-common:1.6.0 -> 1.7.10|    |    |         +--- org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.6.1 (*)|    |    |         \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.0 (*)|    |    +--- androidx.savedstate:savedstate:1.2.0 (*)|    |    +--- androidx.tracing:tracing:1.0.0|    |    |    \--- androidx.annotation:annotation:1.1.0 -> 1.3.0|    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.6.21 -> 1.7.10 (*)|    +--- androidx.annotation:annotation:1.3.0|    +--- androidx.appcompat:appcompat-resources:1.5.1|    |    +--- androidx.annotation:annotation:1.2.0 -> 1.3.0|    |    +--- androidx.collection:collection:1.0.0 -> 1.1.0 (*)|    |    +--- androidx.core:core:1.6.0 -> 1.9.0 (*)|    |    +--- androidx.vectordrawable:vectordrawable:1.1.0|    |    |    +--- androidx.annotation:annotation:1.1.0 -> 1.3.0|    |    |    +--- androidx.core:core:1.1.0 -> 1.9.0 (*)|    |    |    \--- androidx.collection:collection:1.1.0 (*)|    |    +--- androidx.vectordrawable:vectordrawable-animated:1.1.0|    |    |    +--- androidx.vectordrawable:vectordrawable:1.1.0 (*)|    |    |    +--- androidx.interpolator:interpolator:1.0.0|    |    |    |    \--- androidx.annotation:annotation:1.0.0 -> 1.3.0|    |    |    \--- androidx.collection:collection:1.1.0 (*)|    |    \--- androidx.appcompat:appcompat:1.5.1 (c)|    +--- androidx.collection:collection:1.0.0 -> 1.1.0 (*)|    +--- androidx.core:core:1.8.0 -> 1.9.0 (*)|    +--- androidx.core:core-ktx:1.8.0 -> 1.9.0 (*)|    +--- androidx.cursoradapter:cursoradapter:1.0.0|    |    \--- androidx.annotation:annotation:1.0.0 -> 1.3.0|    +--- androidx.drawerlayout:drawerlayout:1.0.0 -> 1.1.1|    |    +--- androidx.annotation:annotation:1.1.0 -> 1.3.0|    |    +--- androidx.core:core:1.2.0 -> 1.9.0 (*)|    |    \--- androidx.customview:customview:1.1.0|    |         +--- androidx.annotation:annotation:1.1.0 -> 1.3.0|    |         +--- androidx.core:core:1.3.0 -> 1.9.0 (*)|    |         \--- androidx.collection:collection:1.1.0 (*)|    +--- androidx.emoji2:emoji2:1.2.0|    |    +--- androidx.annotation:annotation:1.2.0 -> 1.3.0|    |    +--- androidx.collection:collection:1.1.0 (*)|    |    +--- androidx.core:core:1.3.0 -> 1.9.0 (*)|    |    +--- androidx.lifecycle:lifecycle-process:2.4.1|    |    |    +--- androidx.lifecycle:lifecycle-runtime:2.4.1 -> 2.5.1 (*)|    |    |    +--- androidx.startup:startup-runtime:1.1.1|    |    |    |    +--- androidx.annotation:annotation:1.1.0 -> 1.3.0|    |    |    |    \--- androidx.tracing:tracing:1.0.0 (*)|    |    |    \--- androidx.annotation:annotation:1.2.0 -> 1.3.0|    |    \--- androidx.startup:startup-runtime:1.0.0 -> 1.1.1 (*)|    +--- androidx.emoji2:emoji2-views-helper:1.2.0|    |    +--- androidx.collection:collection:1.1.0 (*)|    |    +--- androidx.core:core:1.3.0 -> 1.9.0 (*)|    |    \--- androidx.emoji2:emoji2:1.2.0 (*)|    +--- androidx.fragment:fragment:1.3.6|    |    +--- androidx.annotation:annotation:1.1.0 -> 1.3.0|    |    +--- androidx.core:core:1.2.0 -> 1.9.0 (*)|    |    +--- androidx.collection:collection:1.1.0 (*)|    |    +--- androidx.viewpager:viewpager:1.0.0|    |    |    +--- androidx.annotation:annotation:1.0.0 -> 1.3.0|    |    |    +--- androidx.core:core:1.0.0 -> 1.9.0 (*)|    |    |    \--- androidx.customview:customview:1.0.0 -> 1.1.0 (*)|    |    +--- androidx.loader:loader:1.0.0|    |    |    +--- androidx.annotation:annotation:1.0.0 -> 1.3.0|    |    |    +--- androidx.core:core:1.0.0 -> 1.9.0 (*)|    |    |    +--- androidx.lifecycle:lifecycle-livedata:2.0.0|    |    |    |    +--- androidx.arch.core:core-runtime:2.0.0 -> 2.1.0 (*)|    |    |    |    +--- androidx.lifecycle:lifecycle-livedata-core:2.0.0 -> 2.5.1 (*)|    |    |    |    \--- androidx.arch.core:core-common:2.0.0 -> 2.1.0 (*)|    |    |    \--- androidx.lifecycle:lifecycle-viewmodel:2.0.0 -> 2.5.1 (*)|    |    +--- androidx.activity:activity:1.2.4 -> 1.5.1 (*)|    |    +--- androidx.lifecycle:lifecycle-livedata-core:2.3.1 -> 2.5.1 (*)|    |    +--- androidx.lifecycle:lifecycle-viewmodel:2.3.1 -> 2.5.1 (*)|    |    +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.3.1 -> 2.5.1 (*)|    |    +--- androidx.savedstate:savedstate:1.1.0 -> 1.2.0 (*)|    |    \--- androidx.annotation:annotation-experimental:1.0.0 -> 1.3.0 (*)|    +--- androidx.lifecycle:lifecycle-runtime:2.5.1 (*)|    +--- androidx.lifecycle:lifecycle-viewmodel:2.5.1 (*)|    +--- androidx.resourceinspection:resourceinspection-annotation:1.0.1|    |    \--- androidx.annotation:annotation:1.1.0 -> 1.3.0|    +--- androidx.savedstate:savedstate:1.2.0 (*)|    +--- org.jetbrains.kotlin:kotlin-stdlib:1.7.10 (*)|    \--- androidx.appcompat:appcompat-resources:1.5.1 (c)+--- com.google.android.material:material:1.6.1|    +--- androidx.annotation:annotation:1.2.0 -> 1.3.0|    +--- androidx.appcompat:appcompat:1.1.0 -> 1.5.1 (*)|    +--- androidx.cardview:cardview:1.0.0|    |    \--- androidx.annotation:annotation:1.0.0 -> 1.3.0|    +--- androidx.coordinatorlayout:coordinatorlayout:1.1.0|    |    +--- androidx.annotation:annotation:1.1.0 -> 1.3.0|    |    +--- androidx.core:core:1.1.0 -> 1.9.0 (*)|    |    +--- androidx.customview:customview:1.0.0 -> 1.1.0 (*)|    |    \--- androidx.collection:collection:1.0.0 -> 1.1.0 (*)|    +--- androidx.constraintlayout:constraintlayout:2.0.1 -> 2.1.4|    |    +--- androidx.appcompat:appcompat:1.2.0 -> 1.5.1 (*)|    |    +--- androidx.core:core:1.3.2 -> 1.9.0 (*)|    |    \--- androidx.constraintlayout:constraintlayout-core:1.0.4|    +--- androidx.core:core:1.5.0 -> 1.9.0 (*)|    +--- androidx.drawerlayout:drawerlayout:1.1.1 (*)|    +--- androidx.dynamicanimation:dynamicanimation:1.0.0|    |    +--- androidx.core:core:1.0.0 -> 1.9.0 (*)|    |    +--- androidx.collection:collection:1.0.0 -> 1.1.0 (*)|    |    \--- androidx.legacy:legacy-support-core-utils:1.0.0|    |         +--- androidx.annotation:annotation:1.0.0 -> 1.3.0|    |         +--- androidx.core:core:1.0.0 -> 1.9.0 (*)|    |         +--- androidx.documentfile:documentfile:1.0.0|    |         |    \--- androidx.annotation:annotation:1.0.0 -> 1.3.0|    |         +--- androidx.loader:loader:1.0.0 (*)|    |         +--- androidx.localbroadcastmanager:localbroadcastmanager:1.0.0|    |         |    \--- androidx.annotation:annotation:1.0.0 -> 1.3.0|    |         \--- androidx.print:print:1.0.0|    |              \--- androidx.annotation:annotation:1.0.0 -> 1.3.0|    +--- androidx.annotation:annotation-experimental:1.0.0 -> 1.3.0 (*)|    +--- androidx.fragment:fragment:1.2.5 -> 1.3.6 (*)|    +--- androidx.lifecycle:lifecycle-runtime:2.0.0 -> 2.5.1 (*)|    +--- androidx.recyclerview:recyclerview:1.0.0 -> 1.1.0|    |    +--- androidx.annotation:annotation:1.1.0 -> 1.3.0|    |    +--- androidx.core:core:1.1.0 -> 1.9.0 (*)|    |    +--- androidx.customview:customview:1.0.0 -> 1.1.0 (*)|    |    \--- androidx.collection:collection:1.0.0 -> 1.1.0 (*)|    +--- androidx.transition:transition:1.2.0|    |    +--- androidx.annotation:annotation:1.1.0 -> 1.3.0|    |    +--- androidx.core:core:1.0.1 -> 1.9.0 (*)|    |    \--- androidx.collection:collection:1.0.0 -> 1.1.0 (*)|    +--- androidx.vectordrawable:vectordrawable:1.1.0 (*)|    \--- androidx.viewpager2:viewpager2:1.0.0|         +--- androidx.annotation:annotation:1.1.0 -> 1.3.0|         +--- androidx.fragment:fragment:1.1.0 -> 1.3.6 (*)|         +--- androidx.recyclerview:recyclerview:1.1.0 (*)|         +--- androidx.core:core:1.1.0 -> 1.9.0 (*)|         \--- androidx.collection:collection:1.1.0 (*)\--- androidx.constraintlayout:constraintlayout:2.1.4 (*)(c) - dependency constraint(*) - dependencies omitted (listed previously)A web-based, searchable dependency report is available by adding the --scan option.BUILD SUCCESSFUL in 2s

分析整个依赖 , 发现到处都有 androidx.core:core 依赖库 , 而且版本都不一样 ;

在这里插入图片描述
但是使用到 androidx.core:core:1.9.0 版本的情况 , 只有在 androidx.core:core-ktx:1.9.0 依赖库中出现了 ;

+--- androidx.core:core-ktx:1.9.0|    +--- androidx.annotation:annotation:1.1.0 -> 1.3.0|    +--- androidx.core:core:1.9.0|    |    +--- androidx.annotation:annotation:1.2.0 -> 1.3.0|    |    +--- androidx.annotation:annotation-experimental:1.3.0|    |    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.7.10 (*)|    |    +--- androidx.collection:collection:1.0.0 -> 1.1.0|    |    |    \--- androidx.annotation:annotation:1.1.0 -> 1.3.0|    |    +--- androidx.concurrent:concurrent-futures:1.0.0|    |    |    +--- com.google.guava:listenablefuture:1.0|    |    |    \--- androidx.annotation:annotation:1.1.0 -> 1.3.0|    |    +--- androidx.lifecycle:lifecycle-runtime:2.3.1 -> 2.5.1|    |    |    +--- androidx.annotation:annotation:1.1.0 -> 1.3.0|    |    |    +--- androidx.arch.core:core-common:2.1.0|    |    |    |    \--- androidx.annotation:annotation:1.1.0 -> 1.3.0|    |    |    +--- androidx.arch.core:core-runtime:2.1.0|    |    |    |    +--- androidx.annotation:annotation:1.1.0 -> 1.3.0|    |    |    |    \--- androidx.arch.core:core-common:2.1.0 (*)|    |    |    \--- androidx.lifecycle:lifecycle-common:2.5.1|    |    |         \--- androidx.annotation:annotation:1.1.0 -> 1.3.0|    |    +--- androidx.versionedparcelable:versionedparcelable:1.1.1|    |    |    +--- androidx.annotation:annotation:1.1.0 -> 1.3.0|    |    |    \--- androidx.collection:collection:1.0.0 -> 1.1.0 (*)|    |    \--- androidx.core:core-ktx:1.9.0 (c)|    +--- org.jetbrains.kotlin:kotlin-stdlib:1.7.10 (*)|    \--- androidx.core:core:1.9.0 (c)

其它的依赖库都使用的是低版本的 androidx.core:core 依赖库 ;

直接注释掉 androidx.core:core-ktx:1.9.0 依赖库 , 或者将其降低为 androidx.core:core-ktx:1.8.0 , 都可以解决这个问题 ;

dependencies {    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"    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'}

改为

dependencies {    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"    implementation 'androidx.core:core-ktx:1.8.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'}

只修改了 androidx.core:core-ktx 依赖库的版本由 1.9.0 改为 1.8.0 ;


解决思路 : 某个依赖库报错 , 执行

gradlew app:dependencies --configuration releaseRuntimeClasspath

命令 , 查看该依赖库的依赖关系 , 从属于哪个依赖库 , 与哪个依赖库产生冲突 , 进而解决依赖冲突问题 ;

来源地址:https://blog.csdn.net/shulianghan/article/details/127630948

阅读原文内容投诉

免责声明:

① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。

② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341

软考中级精品资料免费领

  • 历年真题答案解析
  • 备考技巧名师总结
  • 高频考点精准押题
  • 2024年上半年信息系统项目管理师第二批次真题及答案解析(完整版)

    难度     813人已做
    查看
  • 【考后总结】2024年5月26日信息系统项目管理师第2批次考情分析

    难度     354人已做
    查看
  • 【考后总结】2024年5月25日信息系统项目管理师第1批次考情分析

    难度     318人已做
    查看
  • 2024年上半年软考高项第一、二批次真题考点汇总(完整版)

    难度     435人已做
    查看
  • 2024年上半年系统架构设计师考试综合知识真题

    难度     224人已做
    查看

相关文章

发现更多好内容

猜你喜欢

AI推送时光机
位置:首页-资讯-后端开发
咦!没有更多了?去看看其它编程学习网 内容吧
首页课程
资料下载
问答资讯