任务执行失败:app:checkDebugAarMetadata set targetSdkVersion 30 and compileSdkVersion 30

Execution failed for task ':app:checkDebugAarMetadata set targetSdkVersion 30 and compileSdkVersion 30

我设置了 targetSdkVersion 31compileSdkVersion 31 然后代码工作正常但是设置 30 然后显示这个错误。相同的依赖关系和 targetSdkVersion 30compileSdkVersion 31 在其他项目中正常工作。

应用 > build.gradle

    compileSdkVersion 30
    minSdkVersion 21
    targetSdkVersion 30
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.3.1'
    implementation 'com.google.android.material:material:1.5.0-alpha02'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test:runner:1.4.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
    implementation 'com.squareup.retrofit2:retrofit:2.9.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
    implementation 'com.google.code.gson:gson:2.8.8'
    implementation 'androidx.recyclerview:recyclerview:1.2.1'
    implementation 'com.github.bumptech.glide:glide:4.11.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
    implementation 'de.hdodenhof:circleimageview:3.1.0'
    implementation 'io.github.inflationx:calligraphy3:3.1.1'
    implementation 'io.github.inflationx:viewpump:2.0.3'
    implementation 'com.google.android.gms:play-services-ads:20.4.0'
    implementation 'com.google.android.gms:play-services-auth:19.2.0'
    implementation 'com.google.android.ads.consent:consent-library:1.0.8'
    implementation 'com.onesignal:OneSignal:4.6.0@aar'
    implementation 'com.google.firebase:firebase-analytics:19.0.2'
    implementation 'com.google.firebase:firebase-messaging:22.0.0'
    implementation 'org.greenrobot:eventbus:3.1.1'
    implementation 'com.hootsuite.android:nachos:1.2.0'
    implementation 'io.github.lizhangqu:coreprogress:1.0.2'
    implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
    implementation 'com.facebook.android:facebook-login:8.2.0'
    implementation 'com.facebook.android:audience-network-sdk:6.7.0'
    implementation 'com.google.ads.mediation:facebook:6.7.0.0'
    implementation 'androidx.multidex:multidex:2.0.1'
    implementation project(path: ':SmoothCheckBox-master')
}

错误

Execution failed for task ':app:checkDebugAarMetadata'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
   > One or more issues found when checking AAR metadata values:


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.0-beta01.
AAR metadata file: C:\Users\xxxxxxx\.gradle\caches\transforms-3\c087357cd7ca730a7a70e809d3f32e7d\transformed\appcompat-1.4.0-beta01\META-INF\com\android\build\gradle\aar-metadata.properties.

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-resources:1.4.0-beta01.
AAR metadata file: C:\Users\xxxxxxx\.gradle\caches\transforms-3fcd36fda6d7df1068cea6e1908396e\transformed\jetified-appcompat-resources-1.4.0-beta01\META-INF\com\android\build\gradle\aar-metadata.properties.

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.emoji2:emoji2-views-helper:1.0.0-beta01.
AAR metadata file: C:\Users\xxxxxxx\.gradle\caches\transforms-3c70728b6d59cbaa2aa1cc79c71401cb\transformed\jetified-emoji2-views-helper-1.0.0-beta01\META-INF\com\android\build\gradle\aar-metadata.properties.

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.emoji2:emoji2:1.0.0-beta01.
AAR metadata file: C:\Users\xxxxxxx\.gradle\caches\transforms-36b6f4778659e20e574cd2c5de8ecdd\transformed\jetified-emoji2-1.0.0-beta01\META-INF\com\android\build\gradle\aar-metadata.properties.

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.core:core:1.7.0-beta02.
AAR metadata file: C:\Users\xxxxxxx\.gradle\caches\transforms-3\b32d9c74757f1f95bda23786a2ffe204\transformed\core-1.7.0-beta02\META-INF\com\android\build\gradle\aar-metadata.properties.

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.lifecycle:lifecycle-process:2.4.0-beta01.
AAR metadata file: C:\Users\xxxxxxx\.gradle\caches\transforms-3ce95d031480369ca7889d7240482aa4\transformed\jetified-lifecycle-process-2.4.0-beta01\META-INF\com\android\build\gradle\aar-metadata.properties.

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.lifecycle:lifecycle-runtime:2.4.0-beta01.
AAR metadata file: C:\Users\xxxxxxx\.gradle\caches\transforms-3\e0310a9324d75c48d7b1344bbf854472\transformed\lifecycle-runtime-2.4.0-beta01\META-INF\com\android\build\gradle\aar-metadata.properties.

您需要:compileSdkVersion 31 - 或者使用稳定的依赖项构建。