Execution failed for task ':app:checkDebugAarMetadata'

Sha*_*ngh 14 compiler-errors android-studio

I am getting this error while running my app.

Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Could not find com.android.support.constraint:constraint-layout:1.1.3.
     Searched in the following locations:
       - https://jcenter.bintray.com/com/android/support/constraint/constraint-layout/1.1.3/constraint-layout-1.1.3.pom
     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
     Required by:
         project :app
   > Could not find com.android.support:appcompat-v7:25.3.1.
     Searched in the following locations:
       - https://jcenter.bintray.com/com/android/support/appcompat-v7/25.3.1/appcompat-v7-25.3.1.pom
     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
     Required by:
         project :app
   > Could not find com.android.support:support-v4:25.3.1.
     Searched in the following locations:
       - https://jcenter.bintray.com/com/android/support/support-v4/25.3.1/support-v4-25.3.1.pom
     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
     Required by:
         project :app
   > Could not find com.android.support:design:25.3.1.
     Searched in the following locations:
       - https://jcenter.bintray.com/com/android/support/design/25.3.1/design-25.3.1.pom
     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
     Required by:
         project :app

Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
Run Code Online (Sandbox Code Playgroud)

ant*_*_ku 34

我已经有了版本号 30 的compileSdkVersion 和 targetSdkVersion。我添加了build.repositories jcenter()allprojects.repositories jcenter(),之后我构建了react-native应用程序,它工作得很好。

我的构建.gradle

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

buildscript {
    ext {
        buildToolsVersion = "30.0.2"
        minSdkVersion = 21
        compileSdkVersion = 30
        targetSdkVersion = 30
        ndkVersion = "20.1.5948944"
    }
    repositories {
        google()
        mavenCentral()
        jcenter()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:4.2.1")
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenCentral()
        mavenLocal()
        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")
        }

        google()
        jcenter()

        
        maven {
            // All of the Detox artifacts are provided via the npm module
            url("$rootDir/../../../node_modules/detox/Detox-android")
        }
        

    }
}

Run Code Online (Sandbox Code Playgroud)

  • 当我将 React Native 版本从 0.63.4 升级到 0.65.1 时,这对我很有帮助。谢谢。 (2认同)

小智 29

对于我们的 Flutter 项目:导航到应用程序级 build.gradle 文件。将compileSdkVersion从30更改为31并将targetSdkVersion从30更改为31

  • 对于 React Native 也有效! (2认同)

小智 11

这个问题是sdk和jdk版本冲突造成的。首先你可以运行:

npx react-native doctor
Run Code Online (Sandbox Code Playgroud)

运行此命令后,如果出现错误或警告,请按“ e ”、“ w”或“ f ”来修复问题并下载正确的版本。我通常在#30版本中使用compileSdkVersion和targetSdkVersion。您可以将sdkVersion更改为3031


mpo*_*tou 9

就我而言,我打开build.gradle所有库并将其更新为最新库,如下所示 在此输入图像描述


Cha*_*ena 6

更新2021.07

我只需更改build.gradle 文件中的compileSdkVersion和。targetSdkVersion(YourApp\android\build.gradle)。 29日

compileSdkVersion30日2930
targetSdkVersion

进行此更改后,它开始运行。

信用:https ://exerror.com/solved-execution-failed-for-task-appcheckdebugaarmetadata/


小智 0

似乎您正在使用较新版本的 Android Studio,并且您的实现丢失或使用已弃用的库。否则,您可以在文件中尝试以下实现build.gradle (Module: app)

  dependencies {
  def appcompat_version = "1.2.0"
    // ...
    implementation 'com.google.android.material:material: 1.2.1'
    implementation "androidx.constraintlayout:constraintlayout:2.0.2"
    implementation "androidx.appcompat:appcompat:$appcompat_version"
    implementation "androidx.appcompat:appcompat-resources:$appcompat_version"
    implementation "com.android.support:support-core-utils:28.0.0"
    // ...
  }
Run Code Online (Sandbox Code Playgroud)