错误记录Android 编译报错 ( The minCompileSdk (31) specified in a dependency‘s AAR metadata (META-INF/com )

Posted 韩曙亮

tags:

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

文章目录





一、报错信息



Android 工程编译时报错 :

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
   > 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.appcompat:appcompat:1.4.1.
     AAR metadata file: C:\\Users\\octop\\.gradle\\caches\\transforms-2\\files-2.1\\1545d05330b91959e9302573f67dc81d\\appcompat-1.4.1\\META-INF\\com\\android\\build\\gradle\\aar-metadata.properties.

Android 工程中的 Module 的 build.gradle 中配置如下内容 :

android 
    compileSdkVersion 30
    buildToolsVersion "30.0.0"

    defaultConfig 
        applicationId "kim.hsl.paintgradient"
        minSdkVersion 18
        targetSdkVersion 30
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    





二、解决方案



androidx.appcompat:appcompat:1.4.1 依赖库的 minCompileSdk 是 31 31 31 , 因此本应用应该使用 31 版本的 SDK 和 工具 ;

dependencies 
    implementation 'androidx.appcompat:appcompat:1.4.1'

Android 工程中的 Module 的 build.gradle 中配置修成如下即可成功编译 :

android 
    compileSdkVersion 31
    buildToolsVersion "31.0.0"

    defaultConfig 
        applicationId "kim.hsl.paintgradient"
        minSdkVersion 18
        targetSdkVersion 31
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    

以上是关于错误记录Android 编译报错 ( The minCompileSdk (31) specified in a dependency‘s AAR metadata (META-INF/com )的主要内容,如果未能解决你的问题,请参考以下文章

错误记录Android Studio 编译报错 ( The dependency contains Java 8 bytecode. Please enable desugaring by )

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

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

错误记录Android Studio 编译报错 ( Module was compiled with an incompatible version of Kotlin. The binary )

错误记录编译 Linux 内核报错 ( Unable to find the ncurses package. )

错误记录Android Studio 创建报错 ( The length of the module location exceeds the limit of 100 characters. )(代