编译 Android Studio 工程时 , 报如下错误 ;
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-28).
Dependency: androidx.appcompat:appcompat:1.4.1.
AAR metadata file: C:\Users\octop\.gradle\caches\transforms-2\files-2.1\8e0e08f73cb1db91835eb81ec877eaf8\appcompat-1.4.1\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.
* Get more help at https://help.gradle.org
BUILD FAILED in 836ms
报错时说明 androidx.appcompat:appcompat:1.4.1. 依赖库必须以 android-31 进行编译 , 这里降低该依赖库的版本到 ‘androidx.appcompat:appcompat:1.0.0’ 即可 ;