【问题标题】:Execution failed for task ':app:checkDebugAarMetadata'任务“:app:checkDebugAarMetadata”执行失败
【发布时间】:2021-02-07 19:20:08
【问题描述】:

我在运行我的应用程序时遇到此错误。

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

【问题讨论】:

    标签: android-studio compiler-errors


    【解决方案1】:

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

    我的 build.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")
            }
            
    
        }
    }
    
    

    【讨论】:

    • 这在我将我的 react native 版本从 0.63.4 升级到 0.65.1 时帮助了我。谢谢。
    • 这节省了我的时间,谢谢。切换反应原生版本时会发生这种情况
    【解决方案2】:

    就我而言,我打开了build.gradle 并将所有库更新为最新的,如下所示

    【讨论】:

      【解决方案3】:

      2021.07 更新

      我只需要更改 build.gradle 文件中的 compileSdkVersiontargetSdkVersion。 (YourApp\android\build.gradle)。

      compileSdkVersion2930
      targetSdkVersion2930

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

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

      【讨论】:

      • 31 对我有用。
      【解决方案4】:

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

      【讨论】:

        【解决方案5】:

        您似乎使用的是较新版本的 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"
            // ...
          }
        

        【讨论】:

        • 我也有同样的问题。这个解决方案对我不起作用。
        • 我现在解决了这个问题!我刚刚尝试在此解决方案中使用更改代理:stackoverflow.com/questions/63157065/… 这对我有用。试试看。
        【解决方案6】:

        这个错误“Could not resolve all files for configuration ':app:debugRuntimeClasspath”是由于网络故障

        这是因为 Android Studio 无法完全访问 Internet 连接,这是由另一个应用程序控制您的代理引起的。例如查尔斯代理。

        解决方案:

        1. 停止/关闭您计算机上的任何代理应用程序。
        2. 重建项目

        【讨论】:

          【解决方案7】:

          我不知道为什么,但不知何故,我的 gradle 离线模式 在 android studio 4.1.1 更新后打开了,这导致了问题。确保那个东西没有打开!

          【讨论】:

            【解决方案8】:

            这通常发生在您第一次运行项目/或在新设备中运行时, 修复

            1. 确保您有正确的互联网连接
            2. 如果未修复,则在您的 PC 的代理设置中关闭自动检测设置

            【讨论】:

              【解决方案9】:

              我想你首先运行 create apk file cmd 然后运行 ​​build cmd。 问题解决了。

              【讨论】:

                【解决方案10】:

                android>build.gradle

                !正确检查版本

                buildscript {
                    ext {
                        buildToolsVersion = "29.0.3"
                        minSdkVersion = 21
                        compileSdkVersion = 29
                        targetSdkVersion = 29
                        ndkVersion = "20.1.5948944"
                        googlePlayServicesVersion = "17.0.0"
                    }
                    repositories {
                        ...
                    }
                    dependencies {
                        ...
                    }
                }
                

                【讨论】:

                • 你好@Rajendra,感谢您为 Stackoverflow 做出贡献。请在您的回答中提供解释。请查看stackoverflow.com/help/how-to-answer,了解如何提供出色的答案。
                【解决方案11】:

                reactnative/node_modules/react-native-reanimated/android/react-native-reanimated-6*.aar。 只需转到上述路径并复制文件并重命名所需的文件,例如,如果问题没有找到 66.aar 复制并粘贴路径中以前的主 aar 文件和 hermen aar 文件,并将其重命名为 66

                【讨论】:

                  【解决方案12】:

                  对我来说,在 Windows 设置中禁用代理有效

                  【讨论】:

                    猜你喜欢
                    • 1970-01-01
                    • 1970-01-01
                    • 1970-01-01
                    • 2022-01-16
                    • 2021-08-11
                    • 2020-03-07
                    • 1970-01-01
                    • 2021-11-16
                    • 2023-03-15
                    相关资源
                    最近更新 更多