Question

[Solved] Could not resolve com.android.tools.build.gradle:3.0.1

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

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" }
}}

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.

The error message I’m getting is:

> 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 version is 4.3.1 JVM 9.0.1

What can be done to successfully run ‘gradle test’ here?

EDIT:
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'.

When modified the http repo

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

    }

I got:

      > 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

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?

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

Enquirer: kol23

||

Solution #1:

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

Read Google's Maven repository

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

FYI

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/'
    }
}

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
}
Respondent: kol23

Solution #2:

What worked for me was to remove jcenter() and revert Gradle to an earlier version.

Unfortunately the latest stable version in bintray is 2.3.3 , but atleast I was able to build successfully.

My build.gradle now looks like this:

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

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

allprojects {
    repositories {
        maven { url "http://jcenter.bintray.com"}
    }
}
Respondent: IntelliJ Amiya

Solution #3:

Try this and make sure your network works well (no proxy …) :

in gradle-wrapper.properties :

distributionUrl=  https://services.gradle.org/distributions/gradle-4.1-all.zip

and in build.gradle:

buildscript {
    repositories {
        jcenter()
         google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
    }
}

allprojects {
    repositories {
        jcenter()
        google()
    }

}
Respondent: Hristo Stoyanov

Solution #4:

I got the same issue and i solved it by making changes main gradle file, as per suggestion given by android studio

buildscript {
    repositories {
        jcenter()

        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
    }
}

allprojects {
    repositories {
        jcenter()
        google()
    }
}

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

gradle-wrapper.properties :

distributionUrl=  https://services.gradle.org/distributions/gradle-4.1-all.zip

my gradle file is like this, make like this in you project it would most probably work.

Thank you.

Respondent: MrZ

Solution #5:

Not sure but your this error Could not resolve all files for configuration ':classpath'. When your path is not set so Follow below step:

Go to the File -> Setting -> Version Controller

Then you Change VCS to < None >

see below image :

enter image description here

Respondent: Sagar Gadani

Solution #6:

I got the same issue because I used to set proxy(no proxy now) and click the OK button in
proxy setting,
so, check the following:

  1. echo $proxy(mac)
  2. /user/XXX/.gradle/gradle.properties

    # systemProp.https.proxyPort=1080
    # systemProp.http.proxyHost=127.0.0.1
    # systemProp.https.proxyHost=127.0.0.1
    # systemProp.http.proxyPort=1080
    
  3. project/gradle.properties

Respondent: Ali

Solution #7:

I had the same problem, for solving it I did the following

1- install android studio with required SDKs

2- set manual proxy in android studio: File > Settings > Appearance & Behavior > System Settings > HTTP Proxy

3- In android studio click on Gradle icon, to sync project with gradle files.
Then

4- while android studio and proxy are active, in command prompt by running this command “ionic cordova build android” (I was using ionic platform), it will download all requirement gradle libraries and packages.

Respondent: Mingyong Gu

Solution #8:

Add following code into your app level gradle file.

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

Solution #9:

Check that you don’t filter Google IPs.

Respondent: Prashant Amage

Solution #10:

This worked for me, I needed to install google dependencies

enter image description here

Respondent: CoolMind

The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .

Most Popular

To Top
India and Pakistan’s steroid-soaked rhetoric over Kashmir will come back to haunt them both clenbuterol australia bossier man pleads guilty for leadership role in anabolic steriod distribution conspiracy