【问题标题】:Task :app:checkReleaseAarMetadata FAILED react-native任务:app:checkReleaseAarMetadata FAILED react-native
【发布时间】:2023-03-16 09:14:01
【问题描述】:

我正在使用./gradlew assembleRelease 命令为我的项目制作发布版本,但它给了我这个错误。

> Task :app:checkReleaseAarMetadata FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:checkReleaseAarMetadata'.
> 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.core:core:1.7.0-alpha02.
     AAR metadata file: /Users/classic/.gradle/caches/transforms-2/files-2.1/64ba04558e5775ef86bc1e2e88b04a01/core-1.7.0-alpha02/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.

我无法编辑我的build.gradle 来修复此错误,因为项目有一些依赖项在更改compileSdkVersion 后会中断。

编辑
我在android/app/build.gradle 中添加了以下行,但这对我不起作用。

implementation "androidx.core:core-ktx:1.6.0"

相关问题 -> here

【问题讨论】:

标签: react-native gradle react-native-android


【解决方案1】:

最后我通过将以下行添加到android/build.gradle 来修复此错误。

buildscript {
    ext {
        androidXCore = "1.6.0" // <-- Add this line
        buildToolsVersion = "29.0.3"
        minSdkVersion = 21
        compileSdkVersion = 30
        targetSdkVersion = 29
        ndkVersion = "20.1.5948944"
    }

【讨论】:

    猜你喜欢
    • 2019-08-04
    • 1970-01-01
    • 1970-01-01
    • 2022-11-12
    • 2021-09-15
    • 2020-07-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多