error:
A problem occurred configuring root project 'android'.
Could not resolve all files for configuration ':classpath'.
Could not resolve com.android.tools.build:gradle:3.0.1.
Required by:
project :
Could not resolve com.android.tools.build:gradle:3.0.1.
Could not get resource 'https://jcenter.bintray.com/com/android/tools /build/gradle/3.0.1/gradle-3.0.1.pom'.
Could not GET 'https://jcenter.bintray.com/com/android/tools/build /gradle/3.0.1/gradle-3.0.1.pom'.
jcenter.bintray.com
Could not resolve com.android.tools.build:gradle:3.0.1.
Could not get resource 'https://maven.google.com/com/android/tools/bu ild/gradle/3.0.1/gradle-3.0.1.pom'.
Could not GET 'https://maven.google.com/com/android/tools/build/gr adle/3.0.1/gradle-3.0.1.pom'.
dl.google.com
while i can download gradle-3.0.1.pom in my browser.
my env:
android studio 3.2.1
cordova 8.1.2
win 10
I tried to force gradle-wrapper.properties to use http for
distributionUrl=http\://services.gradle.org/distributions/gradle-4.1-all.zip
but no succuss.
I removed and reinstalled cordova,android studio and sdk build tools to latest versions and problem is still remain.
my build.gradle :
buildscript {
repositories {
maven {
url "https://maven.google.com"
}
jcenter()
}
dependencies {
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
allprojects {
repositories {
maven {
url "https://maven.google.com"
}
jcenter()
}
//This replaces project.properties w.r.t. build settings
project.ext {
defaultBuildToolsVersion="27.0.1" //String
defaultMinSdkVersion=19 //Integer - Minimum requirement is Android 4.4
defaultTargetSdkVersion=27 //Integer - We ALWAYS target the latest by default
defaultCompileSdkVersion=27 //Integer - We ALWAYS compile with the latest by default
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
changing maven url to google() is not working.
enable embedded maven repository in android studio is not a solution.
Related
For new android studio tool with following build script
repositories {
mavenLocal()
mavenCentral()
google()
jcenter()
}
// Switch the Android Gradle plugin version requirement depending on the
// installed version of Gradle. This dependency is documented at
// http://tools.android.com/tech-docs/new-build-system/version-compatibility
// and https://issues.apache.org/jira/browse/CB-8143
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
}
}
I am getting following error.
A problem occurred evaluating root project 'android'.
Could not resolve all artifacts for configuration 'classpath'.
Could not find com.android.tools.build:gradle:4.0.1.
Searched in the following locations:
- https://jcenter.bintray.com/com/android/tools/build/gradle/4.0.1/gradle-4.0.1.pom
- https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/4.0.1/gradle-4.0.1.pom
Required by:
unspecified:unspecified:unspecified
There website shows that we need to add google in buildscript, which is right there.
https://developer.android.com/studio/releases/gradle-plugin
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.
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
}
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.
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"}
}
}
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()
}
}
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"}
}
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 :
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:
echo $proxy(mac)
/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
project/gradle.properties
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.
Check that you don't filter Google IPs.
This worked for me, I needed to install google dependencies
Another explanation is VPN. When my work's VPN is ON, on my Mac, I get this error. When off, I don't. Could be something particular to my VPN's configuration. So, if you have a VPN running, try disabling it turning the build.
I had problems with the snap version of gradle in my GNU/Linux distribution.
I fixed with:
sudo snap remove gradle
sudo apt install gradle
I tried to build an andruid application using latest andruid studio
Seems that gradle is blocked due to lack of jcenter certificate in local machine certstore. My colleguee succeed to build it on his machine so the problem is in the configuration and not the application code
Configuration : andruid studio 3.0.1, gradle 3.0.0 ?, windows 7
I also tried to workaround ssl handshake by replacing jcenter() in build.gradle with
maven {
url "http://jcenter.bintray.com"
}
but it didn't solve the problem
My build.gradle below:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Gradle console:
Executing tasks: [assemble]
Configuration on demand is an incubating feature.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'PDA'.
> Could not resolve all files for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:3.0.0.
Required by:
project :
> Could not resolve com.android.tools.build:gradle:3.0.0.
> Could not get resource 'http://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom'.
> Could not HEAD 'http://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom'.
> Connect to repo.jfrog.org:80 [repo.jfrog.org/52.72.224.151, repo.jfrog.org/34.204.33.255] failed: Connection timed out: connect
The plugin v.3.x.x
classpath 'com.android.tools.build:gradle:3.0.0'
is not in jcenter.
You have to use the google maven repo.
buildscript {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
If you are using Android Studio 3 and gradle v.4.x you can use the google() shortcut
buildscript {
repositories {
...
google()
}
}
Besides as #GabrieleMariotti alreay said, that library will not be found at JCenter, you should not get Connection timed out: connect but a message that the library was not found.
Connection timed out: connect hints, that you cannot access that URL from your machine. My best guess is that you have to use some Proxy to access this URL that properly configured for your colleague, but not for you.
I'm trying to update gradle from 1.3.1 to 3.5, as some of my dependencies requires version 3.3 or above.
I've seen similar questions, but none of them help.
build.gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5'
}
}
gradle-wrapper.properties:
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-all.zip
Still i'm getting this when trying to do anything (build, clean etc):
Building and installing the app on the device (cd android && ./gradlew installDebug...
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'chat'.
> Could not resolve all dependencies for configuration ':classpath'.
> Could not find com.android.tools.build:gradle:3.5.
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/gradle/3.5/gradle-3.5.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/3.5/gradle-3.5.jar
Required by:
project :
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
To fix this issue check do you have google() repo in your project's level build.gradle file.
buildscript {
repositories {
jcenter()
google() //HAVE YOU MISS IT?
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
}
}
allprojects {
repositories {
jcenter()
google() //HAVE YOU MISS IT?
}
}
There is a difference between the Android Plugin for Gradle version and the Gradle version being used. The plugin version typically matches the version number of Android Studio you are using. See the documentation for more information. So if using the latest stable Android Studio it should currently be com.android.tools.build:gradle:2.3.1.
These values can also be reviewed and set from the Project Structure window in Android Studio.
Try this
** If you are using android studio 3.5 and your build.gradle(Project
level) is=> classpath 'com.android.tools.build:gradle:3.5.1' or =>
classpath 'com.android.tools.build:gradle:3.5.1'.
than replace with ***
classpath 'com.android.tools.build:gradle:3.3.2' to
classpath 'com.android.tools.build:gradle:3.5.0'
OR
classpath 'com.android.tools.build:gradle:3.5.1'
I had google() repo both in buildscript and allprojects repositories, but still it shows me Could not find gradle-3.5.3 error
Finally I added maven { url "https://maven.google.com" }, and it fixed the errors!
project's level build.gradle:
buildscript {
ext {
buildToolsVersion = "29.0.2"
minSdkVersion = 16
compileSdkVersion = 29
targetSdkVersion = 29
}
repositories {
maven { url "https://maven.google.com" } // <= this line
google()
jcenter()
}
dependencies {
classpath("com.android.tools.build:gradle:3.5.3")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven { url "https://maven.google.com" } // <= this line
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
google()
jcenter()
maven { url 'https://www.jitpack.io' }
}
}
You may need to save your build.gradle (for whatever reason, Android Studio doesn't always save your latest changes, as I found even with Android Studio 3.5.3, the gradle sync kept failing even after I had changed the classpath line, and it only picked up the new value after saving the build.gradle file)
I got an error after changing version code from 2 to 2.1.
When I opened the build with ctrl+shift+alt+s, I realized adding .1 (decimals) resulted in a $ symbol being added to the right and so build failed. I opted to use numbers without decimal positions and it worked.
For example, I used 3 for buildversion because I wanted to upgrade the app in playstore.
I updated Android Studio to 1.4.1 version. gradle sync said needs to version 2.2.1.
I downloaded gradle 2.2.1 and in file-->settings-->gradle set use default gradle wrapper and in 'project location/gradle/wrapper/gradle-wrapper.properties' set distributionUrl=https://services.gradle.org/distributions/gradle-2.2.1-all.zip.
but android studio has errors:
Error:A problem occurred configuring root project 'Scanner'.
Could not resolve all dependencies for configuration ':classpath'.
Could not resolve com.android.tools.build:transform-api:2.0.0-deprecated-use-gradle-api.
Required by:
:Scanner:unspecified > com.android.tools.build:gradle:2.2.1 > com.android.tools.build:gradle-core:2.2.1
Could not resolve com.android.tools.build:transform-api:2.0.0-deprecated-use-gradle-api.
Could not parse POM https://jcenter.bintray.com/com/android/tools/build/transform-api/2.0.0-deprecated-use-gradle-api/transform-api-2.0.0-deprecated-use-gradle-api.pom
Content is not allowed in prolog.
what is problem? and how can solve this?
gradle file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
If you are behind a proxy, try Gradle proxy configuration. From the error log you posted it looks like gradle is not able to resolve addresses. Make sure gradle has internet access.
Also you can try the following change in jcenter().
buildscript {
repositories {
jcenter {
url "http://jcenter.bintray.com/"
}
}
}
allprojects {
repositories {
jcenter {
url "http://jcenter.bintray.com/"
}
}
}
This many a times fixes the issue.