[android] Could not resolve all dependencies for configuration ':classpath'

I cant seem to get build tools for the latest gradle at all. I suspect its something to do with proxy setting for gradle. I have had a good look online but still cant seem to find a solution. I use gradle 2.1.

I created gradle.properties file in my /home/user/.gradle folder with these setting.

systemProp.http.proxyHost=proxy systemProp.http.proxyPort=80 systemProp.http.proxyUser=myusername systemProp.http.proxyPassword=password

systemProp.https.proxyHost=proxy systemProp.https.proxyPort=80 systemProp.https.proxyUser=myusername systemProp.https.proxyPassword=password

Here is my global build.gradle

buildscript {
    repositories {
        mavenLocal()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:0.13.0'
        classpath fileTree(dir: 'build-libs', include: '*.jar')
    }
}


allprojects {
    repositories {
        mavenCentral()
    }
}

And here is the error i get when running grawlew Could not HEAD 'https://repo1.maven.org/maven2/com/android/tools/build/gradle/0.13.0/gradle-0.13.0.pom'. peer not authenticated

What am i missing? that maven link opens fine in a browser.

This question is related to android maven proxy gradle build-tools

The answer is


I was facing the same issue, it was because of the cache. You just need to follow these Steps:

  1. Go to File -> Invalidate Caches / Restart
  2. After restarting Android Studio, connect your PC to a good network.
  3. Go to build and choose rebuild, and Android Studio will automatically download the missing files for the project

I try to modify the repositories and import the cer to java, but both failed, then I upgrade my jdk version from 1.8.0_66 to 1.8.0_74, gradle build success.


  • I am working with flutter in the VS Code.
  • In my case, I solved it by stopping gradlew process in VS code using the below command

    android/gradlew --stop


Go to File --> Invalidate Caches / Restart. It worked for me.


I'm using Gradle plugin 3.0.1 and saw this error. Not sure what caused this but the solution that works for me is to stop the running Gradle daemon by ./gradlew --stop.


The solution is in your build.gradle change this block:

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

to google in first position :

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

I had this issue and it was because I hadn't added an exception for gradle in my firewall (TinyWall).


For newer android studio 3.0.0 and gradle update, this needed to be included in project level build.gradle file for android Gradle build tools and related dependencies since Google moved to its own maven repository.

// Top-level build file where you can add configuration options common to all sub-projects/modules.

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

        // NOTE: Do not place your application dependencies here; they belong
    }
}

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

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

In the Android Studio v4.0, you should be off the Gradle offline-mode and retry to sync Gradle.


late but it worked for me:
change your dns setting by going Network and sharing center.
In left pane choose change adapter setting
-right click on your network connection
-properties
-select ipv4
-properties
- now in dns server setting:-
-choose the option use the following dns server addresses
and use google dns server 8.8.8.8 as preferred dns server and 8.8.4.4 as alternate dns server.

it will solve your problem.


In my case, my Android Studio version was 3.6.1 and i have modified the classpath like below;

classpath 'com.android.tools.build:gradle:3.6.1'

and that error was gone.


you should have gradle.properties file defined for the build with proxy settings so that gradle knows how to use http connection

# This file contains the basics for Maven Version control and will be used by the Artifactory Release management
# These settings are for the root project and all sub-projects in this application
releaseVersion=1.0.0-SNAPSHOT
releaseGroup=com.xx.xx.xx
artifactory_user=
artifactory_password=
artifactory_contextUrl=https://artifactory.xxxx.com/artifactory/
systemProp.http.proxyHost=proxy.xxx.com
systemProp.http.proxyPort=8080
systemProp.https.proxyHost=proxy.xxx.com
systemProp.https.proxyPort=8080
systemProp.http.nonProxyHosts=*.xxx.com|localhost|*.int.targoe.com
org.gradle.java.home=C:\\Program Files (x86)\\Java\\jdk1.8.0_121

In my case deleting the .gradle folder worked for me.


Find and Replace:

jcenter()
maven {
    url "https://maven.google.com"
}

to:

maven {
    url "https://maven.google.com"
}
jcenter()

I got this issue solved by switching internet from Wifi to mobile hot-spot. It means this issue occurs due to network issue. I could also see below logs which confirms my understanding,

Connect to jcenter.bintray.com:443 [jcenter.bintray.com/75.126.118.188] failed: Connection timed out: connect

and

Connect to repo1.maven.org:443 [repo1.maven.org/151.101.36.209] failed: Connection timed out: connect

Hope it helps.


I installed new Android Studio and faced with this problem. Nothing is helped me except of downloading a few more Android SDK versions: Added Android Q and Android Pie to downloaded and installed SDK


I got the same problem. Just use File->INVALIDATE CACHES AND RESTART


You should have gradle-wrapper.properties inside gradle/wrapper folder. Make sure you are using the right distributionURL, and the latest one. It should look something like this :

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

6 years later here, but for them who are stil facing this issue, I solved it as following. It happened when my module had a different gradle version than the main project. I had gradle version 3.5.3 in project and an older version in module. So, I Just updated that version. The file is here:

./node-modules/[module-name]/android/build.gradle


**A problem occurred evaluating project ':app'.

Could not resolve all files for configuration 'classpath'.**

Solution: Platform->cordova-support-google-services

In this file Replace classpath 'com.android.tools.build:gradle:+' to this classpath 'com.android.tools.build:gradle:3.+'


I had a same problem and I fix it with the following steps:

  1. check the event log and if you see the errors like "cash version is not available for the offline mode" follow the steps.
  2. click on View => Gradle then new window will open.
  3. click on the WIFI icon and then sync the Gradle.enter image description here "if you see different errors from what I mentioned in number one, please go to the file -> project structure -> and there is suggestion"

If adding google() into your build.gradle doesn't work try adding it at first place in your repositories section of node_modules/YOUR_PACKAGE/android/build.gradle file.


Tools > SDK Manager > SDK Tools > Show Package Details and remove all the old versions

enter image description here


Android Studio > view > tool Windows > Gradle > click toggle offline mode (besides gradle settings icon)

this work for me :)


Examples related to android

Under what circumstances can I call findViewById with an Options Menu / Action Bar item? How to implement a simple scenario the OO way My eclipse won't open, i download the bundle pack it keeps saying error log getting " (1) no such column: _id10 " error java doesn't run if structure inside of onclick listener Cannot retrieve string(s) from preferences (settings) strange error in my Animation Drawable how to put image in a bundle and pass it to another activity FragmentActivity to Fragment A failure occurred while executing com.android.build.gradle.internal.tasks

Examples related to maven

Maven dependencies are failing with a 501 error Why am I getting Unknown error in line 1 of pom.xml? Why am I getting "Received fatal alert: protocol_version" or "peer not authenticated" from Maven Central? How to resolve Unable to load authentication plugin 'caching_sha2_password' issue Unable to compile simple Java 10 / Java 11 project with Maven ERROR Source option 1.5 is no longer supported. Use 1.6 or later 'react-scripts' is not recognized as an internal or external command How to create a Java / Maven project that works in Visual Studio Code? "The POM for ... is missing, no dependency information available" even though it exists in Maven Repository Java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/exc/InvalidDefinitionException

Examples related to proxy

Axios having CORS issue Running conda with proxy WebSockets and Apache proxy : how to configure mod_proxy_wstunnel? "Proxy server connection failed" in google chrome Set proxy through windows command line including login parameters Could not resolve all dependencies for configuration ':classpath' Problems using Maven and SSL behind proxy Using npm behind corporate proxy .pac git returns http error 407 from proxy after CONNECT Forwarding port 80 to 8080 using NGINX

Examples related to gradle

Gradle - Move a folder from ABC to XYZ A failure occurred while executing com.android.build.gradle.internal.tasks Gradle: Could not determine java version from '11.0.2' Android Gradle 5.0 Update:Cause: org.jetbrains.plugins.gradle.tooling.util Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0 Failed to resolve: com.android.support:appcompat-v7:28.0 Failed to resolve: com.google.firebase:firebase-core:16.0.1 com.google.android.gms:play-services-measurement-base is being requested by various other libraries java.lang.NoClassDefFoundError:failed resolution of :Lorg/apache/http/ProtocolVersion Error - Android resource linking failed (AAPT2 27.0.3 Daemon #0)

Examples related to build-tools

How can I install the VS2017 version of msbuild on a build server without installing the IDE? Could not resolve all dependencies for configuration ':classpath' How to install Android SDK Build Tools on the command line? ant warning: "'includeantruntime' was not set"