【问题标题】:Execution failed for task ':app:checkDebugAarMetadata' on npx react-native run-androidnpx react-native run-android 上的任务 \':app:checkDebugAarMetadata\' 执行失败
【发布时间】:2022-11-05 01:48:01
【问题描述】:

我试图更改 compileSdkVersion = 30 和 targetSdkVersion = 30 但仍然没有用它一次又一次地给出相同的错误我清理 Gradle 但仍然没有用,所以如果你能提供帮助,请帮助我。从今天开始,这个错误已经持续了将近 3 到 4 天,在此之前我的项目运行良好。我也试过清洁gradel,但仍然没有用。

这是我收到的错误正文错误正文:

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
   > One or more issues found when checking AAR metadata values:
     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-31).
     Dependency: androidx.browser:browser:1.5.0-alpha01.
     AAR metadata file: C:\Users\hp\.gradle\caches\transforms-3\a7a45c1d439f263d5595caa518b0e64b\transformed\browser-1.5.0-alpha01\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 50s

我的安卓/build.gradle:


// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {
        buildToolsVersion = "31.0.0"
        minSdkVersion = 21
        compileSdkVersion = 31
        targetSdkVersion = 31

        if (System.properties['os.arch'] == "aarch64") {
            // For M1 Users we need to use the NDK 24 which added support for aarch64
            ndkVersion = "24.0.8215888"
        } else {
            // Otherwise we default to the side-by-side NDK version from AGP.
            ndkVersion = "22.0.7026061"
        }
    }
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:7.0.4")
        classpath("com.facebook.react:react-native-gradle-plugin")
        classpath("de.undercouch:gradle-download-task:4.1.2")
        classpath 'com.google.gms:google-services:4.3.13'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}
allprojects {
    repositories {
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }
        mavenCentral {
            // We don't want to fetch react-native from Maven Central as there are
            // older versions over there.
            content {
                excludeGroup "com.facebook.react"
            }
        }
        google()
        maven { url 'https://www.jitpack.io' }
    }
}```
please do help if you can thank you.

【问题讨论】:

    标签: android reactjs react-native build.gradle


    【解决方案1】:

    这是我为解决它所做的。该项目位于RN-0.66.4(我将其升级到最新版本 RN-0.70.4)

    • 然后在android/build.gradle 中,我将compileSdkVersion 从31 更新为33。

    这是我下面的配置。 enter image description here

    我希望它有所帮助。

    【讨论】:

      猜你喜欢
      • 2021-09-14
      • 2022-11-18
      • 1970-01-01
      • 2022-01-19
      • 1970-01-01
      • 1970-01-01
      • 2023-02-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多