无法解析配置的所有文件:':app:debugRuntimeClasspath'

Could not resolve all files for configuration: ':app:debugRuntimeClasspath'

我在尝试实施第三方 SDK 捆绑包时 运行 react-native run-android 我收到以下错误:

Execution failed for task ':app:checkDebugAarMetadata'.

Could not resolve all files for configuration ':app:debugRuntimeClasspath'.

Could not resolve com.ts.auth-control-sdk:5.1.1. Required by: project :app

  > Could not resolve com.ts:auth-control-sdk:5.1.1.
    > Could not get resource 'https://www.jitpack.io/com/ts/auth-control-sdk/5.1.1/auth-control-sdk-5.1.1.pom'.
      > Could not GET 'https://www.jitpack.io/com/ts/auth-control-sdk/5.1.1/auth-control-sdk-5.1.1.pom'.
        > sun.security.validator.Validator.Exception: PKIX path building failed:

sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

在我的 app/build.gradle 文件中,我有以下设置:

dependencies {
  ...
  implementation "com.ts:auth-control-sdk:5.1.1:arr"
  ...
}

在我的 android/build.gradle 文件中,我有以下内容:

allprojects {
  repositories {
    ...
    maven {
      url("$rootDir/../com/ts/auth-control-sdk/5.1.1")
    }

    google()
    jcenter()
    maven { url 'https://jitpack.io' }
  }
}

我什至不确定这个第三方 SDK 是否存在于 Jitpack 存储库中。

我是不是在实现依赖关系的方式上犯了错误?

至于 maven 目录,根据文档,我在移动应用程序的根文件夹中放置了一个名为 com/ 的文件夹,其文件夹结构为: com > ts > auth-control-sdk > 5.1.1

似乎如果它在 maven {} 内部,它将转到 Jitpack 存储库并查找库,而不是仅仅转到项目的根文件夹。我这个结论正确吗?

顺便说一句,我把它放在 maven {} 里面,因为他们的文档说要这样做。

难道是 $rootDir 指示 maven 去看看 Jitpack,因为在所有库下面有:

maven { url 'https://www.jitpack.io' }

我得出的结论是 $rootDir 引用的是 jitpack url 而不是应用程序的根目录吗?

好吧,我试了一下,结果出现了同样的错误。

我相信我根据此文档正确标记了该文件: https://docs.gradle.org/current/javadoc/org/gradle/api/artifacts/dsl/DependencyHandler.html

我不是这样标注的:implementation ("com.ts:auth-control-sdk-5.1.1@arr") { transitive=true }

并删除了以下内容:maven { url 'https://www.jitpack.io' }

但是我得到这个错误:

Execution failed for task ':app:checkDebugAarMetadata'.

Could not resolve all the files for configuration 'app:debugRuntimeClasspath'.

Could not find com.ts:auth-control-sdk-5.1.1:. Required by project :app

对我有用的是 android/build.gradle:

maven {
  url("$rootDir/..")
}

我还删除了:

maven {
  url { www.jitpack.io/ }
}

这样它就不会继续去 Jitpack 仓库寻找那个本地目录。

然后在app/build.gradle里面:

dependencies {
   ...
   implementation('com.ts:auth-control-sdk:5.1.1@aar') { transitive=true }
}

如果您面临 Gradle 依赖项 iss> Task :app:mergeDebugNativeLibs FAILED

Error Image

FAILURE: Build completed with 6 failures.

Execution failed for task ':app:checkDebugDuplicateClasses'. Execution failed for task ':app:desugarDebugFileDependencies'. Execution failed for task ':app:checkDebugAarMetadata'. Execution failed for task ':app:mergeDebugAssets'. Execution failed for task ':app:mergeDebugAssets'. Execution failed for task ':app:mergeDebugNativeLibs'.ue

在android工作室?

答案: 如果您在项目中使用 ANDROID 11 然后尝试以下选项 转到设置 单击 Gradle 选项,执行,部署 然后点击构建工具 Solution Image 选择 gradle

然后关闭离线模式然后运行

**go to your setting.gradle and write the below line of code for the the control 
       of 
  libraries or dependencies **
     
     maven { url 'https://jitpack.io' }




      dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
    google()
    mavenCentral()
    jcenter() // Warning: this repository is going to shut down soon

    maven { url 'https://jitpack.io' }
}

} rootProject.name = "Xyz" 包括 ':app'