无法解析com.android.tools.build.gradle:3.0.1 [英] Could not resolve com.android.tools.build.gradle:3.0.1

查看:102
本文介绍了无法解析com.android.tools.build.gradle:3.0.1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在强迫gradle使用http 我已经修改了gradle-wrapper.properties:

I'm forcing gradle to use http I have modified my gradle-wrapper.properties:

distributionUrl=http\://services.gradle.org/distributions/gradle-4.3-all.zip

build.gradle:

The build.gradle:

buildscript {
repositories {
    //jcenter()
    //google()
    maven { url "http://jcenter.bintray.com"}     
    }
dependencies {
    classpath 'com.android.tools.build:gradle:3.0.1'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}}

allprojects {
repositories {
    jcenter()
    maven { url 'http://maven.google.com' }
    maven { url "http://jitpack.io" }
}}

据我所知,我应该使用3.0.1,但是当我检查jitpack或maven上的实际仓库时,最多只能使用2.3.3.

As far as I'm aware I should use 3.0.1 but when I check the actual repo on jitpack or maven only up to 2.3.3 is available.

我收到的错误消息是:

> Could not resolve all files for configuration ':classpath'.
> Could not find com.android.tools.build:gradle:3.0.1.
Searched in the following locations:
http://jcenter.bintray.com/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.pom
http://jcenter.bintray.com/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.jar
Required by:
     project :* Try:

Gradle版本为4.3.1 JVM 9.0.1

Gradle version is 4.3.1 JVM 9.0.1

如何在此处成功运行等级测试"?

What can be done to successfully run 'gradle test' here?

取消注释//google()透露:

uncommenting //google() reveled:

       > Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.pom'.
        > Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.pom'.

修改后的http存储库

When modified the http repo

buildscript {
repositories {
    //jcenter()
    //google()
    maven { url "http://jcenter.bintray.com"}
    maven { url "http://maven.google.com"}

    }

我得到了:

      > Could not resolve com.android.tools.build:gradle:3.0.1.
     > Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.pom'.
        > Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.pom'.
           > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
  > Could not resolve com.android.tools.build:gradle:3.0.1.
     > Could not get resource 'http://maven.google.com/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.pom'.
        > Could not GET 'http://maven.google.com/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.pom'.
           > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

如果我取消对jcenter()和google()的注释,我将得到相同的结果.此外,当我检查 https://dl.google .com/dl/android/maven2/com/android/tools/build/gradle/链接无效. 现在,jcenter存储库 https://repo1.maven.org/maven2/com/android/tools/build/gradle/结束于2.3.3版本,这似乎是正确的,表明发生了此错误,那么问题是什么呢?

I get the same if I uncomment both jcenter() and google(). Besides, when I check https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/ the link is dead. Now the jcenter repo https://repo1.maven.org/maven2/com/android/tools/build/gradle/ ends on 2.3.3 version which seems to be correct that this error is happening, the question is what is wrong then?

编辑-可能解决了该问题,因为您无法完全运行那些不包括https的内容,但是这两种方法都会失败.

EDIT- Likely solution the issue happenned because you can't run those excluding https completely, it will fail either way.

推荐答案

无法解析com.android.tools.build:gradle:3.0.1.

Could not resolve com.android.tools.build:gradle:3.0.1.

阅读 Google's Maven repository

在您的顶级 build.gradle 文件中包含Google的Maven存储库:

Include Google's Maven repository in your top-level build.gradle file:

仅供参考

allprojects {
    repositories {
        google()

        // If you're using a version of Gradle lower than 4.1, you must instead use:
        // maven {
        //     url 'https://maven.google.com'
        // }
        // An alternative URL is 'https://dl.google.com/dl/android/maven2/'
    }
}

因此,根据您的版本,您的 build.gradle

So, According to your version your build.gradle will

buildscript 
{

    repositories {
        jcenter()
        google()
        maven { url "http://jcenter.bintray.com"}     
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'

    }
}

allprojects 
{
    repositories {
        jcenter()
        maven { url "https://jitpack.io" }
        google()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

这篇关于无法解析com.android.tools.build.gradle:3.0.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆