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

Posted 韩曙亮

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了错误记录Android Studio 编译报错 ( The minCompileSdk (33) specified in a dependency‘s AAR metadata META-I )相关的知识,希望对你有一定的参考价值。

文章目录





一、报错信息



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 releaseRuntimeClasspath
WARNING:: 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
|    |         +---以上是关于错误记录Android Studio 编译报错 ( The minCompileSdk (33) specified in a dependency‘s AAR metadata META-I )的主要内容,如果未能解决你的问题,请参考以下文章

错误记录Android Studio 编译报错 ( Could not determine java version from ‘11.0.8‘. | Android Studio 降级 )(代码片段

错误记录Android Studio 编译报错 ( Could not determine java version from ‘11.0.8‘. | Android Studio 降级 )(代码片段

错误记录Android Studio 编译时 Kotlin 代码编译报错 ( 升级支持库时处理 @NonNull 参数 )

错误记录Android Studio 编译报错 ( Invalid main APK outputs : EarlySyncBuildOutput )

错误记录Android Studio 编译报错 ( Invalid Gradle JDK configuration found )

错误记录Android Studio 编译报错 ( VirtualApp 编译 NDK 报错 | Error:A problem occurred configuring project ‘: )(代