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.
5 Answers
Answers 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 }
Answers 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"} } }
Answers 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() } }
Answers 4
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 :
Answers 5
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.
0 comments:
Post a Comment