Gradle尝试从错误的存储库下载

时间:2019-08-07 14:06:27

标签: android maven gradle artifactory

我的Android APP仅指向我的内部Artifactory。但是,当尝试从jcenter.bintray下载play-services-base

时,构建中断

有趣的是,我从不在项目级别或模块/应用级别引用build.gradle中的jcenter。

play-services-base在我的jfrog中可用。

我尝试先运行./gradlew任务,以强制gradle在构建之前下载依赖项。

在我的项目级别build.gradle

allprojects {
    apply plugin: "com.jfrog.artifactory"

    ...

    repositories {
        maven {
            url "${rootDir}/react-native/android"
        }
        maven {
            url 'http://fakeurl/from_artifactory/repository'
            credentials {
                username = "fakeuser"
                password = "fakepassword"
            }
        }
    }
}

build.gradle模块级别

api "com.google.android.gms:play-services-gcm:$gcm_version"
api "com.google.android.gms:play-services-maps:$gcm_version"
api "com.google.android.gms:play-services-vision:$gcm_version"
api 'com.google.android.gms:play-services-analytics:16.0.3'

错误:

> Could not resolve com.google.android.gms:play-services-base:[15.0.1,16.0.0).
  Required by:
      project :module1 > project :module2 > com.google.android.gms:play-services-gcm:15.0.1
      project :module1 > project :module2 > com.google.android.gms:play-services-maps:15.0.1
      project :module1 > project :module2 > com.google.android.gms:play-services-vision:15.0.1
      project :module1 > project :module2 > com.google.android.gms:play-services-gcm:15.0.1 > com.google.android.gms:play-services-iid:15.0.1
      project :module1 > project :module2 > com.google.android.gms:play-services-vision:15.0.1 > com.google.android.gms:play-services-vision-common:15.0.1
      project :module1 > project :module2 > com.google.android.gms:play-services-vision:15.0.1 > com.google.android.gms:play-services-vision-common:15.0.1 > com.google.android.gms:play-services-clearcut:15.0.1
      project :module1 > project :module2 > com.google.android.gms:play-services-vision:15.0.1 > com.google.android.gms:play-services-vision-common:15.0.1 > com.google.android.gms:play-services-clearcut:15.0.1 > com.google.android.gms:play-services-phenotype:15.0.1

166 actionable tasks: 166 executed
   > Failed to list versions for com.google.android.gms:play-services-base.
      > Unable to load Maven meta-data from https://jcenter.bintray.com/com/google/android/gms/play-services-base/maven-metadata.xml.
         > Could not get resource 'https://jcenter.bintray.com/com/google/android/gms/play-services-base/maven-metadata.xml'.
            > Could not GET 'https://jcenter.bintray.com/com/google/android/gms/play-services-base/maven-metadata.xml'.
               > Connect to jcenter.bintray.com:443 [jcenter.bintray.com/52.40.226.158, jcenter.bintray.com/52.11.213.218] failed: connect timed out

1 个答案:

答案 0 :(得分:0)

我看不到build.gradle中有“ play-services-base”的要求,所以我想它与您要提取的一个或多个软件包有关。我的猜测是,要提取的其中一个软件包的“ pom.xml”文件将此软件包作为依赖项引用,并且JCenter URL硬编码为“ pom.xml”。您将需要找到此“ pom.xml”文件,并将URL从JCenter更改为Artifactory实例。