Gradle build error in Android Studio 3.1.3.2
The default gradle install is part of Android Studio sdk so if you moved your Android Studio files location or have the wrong PATH defined in your environment it won't find the sdk location like this. If your path is to a different android studio installation version it might not have that particular version of gradle in it.
Android Studio: Gradle sync failed: Could not HEAD '...'. Received status code 502 from server: Bad Gateway
jcenter is having issues at the moment, please check http://status.bintray.com/
EDIT: it looks like the link above was sunset, new link at: https://status.gradle.com/
Gradle sync failed: Could not find com.android.tools.build:gradle:5.5.1
This dependency corresponds to the Android gradle plugin, not Gradle itself. Typically, the Android gradle plugin should match the version number of your Android Studio installation (e.g. "3.4.2").
If you want to update Gradle itself, and you are using the gradle wrapper, update the gradle/wrapper/gradle-wrapper.properties
file and edit the distributionUrl
line:
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-all.zip
If you are using a local distribution, then you don't have to do anything. Your project will be built using the gradle distribution set in the Android Studio settings (in your case, Gradle 5.5.1).
Edit: It seems that your build.gradle file is also missing the google()
repositories, here is what it should look like if you want to use the Android gradle plugin 3.4.2:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
gradle sync failed after updated android studio
I found the problem...
When the project gets built, it builds the gradle online/loads the gradle. As it seems, my company network has blocked this, so it can't get built.
Working over Hotspot it works perfectly fine.
Thanks for all your kind help :)
Gradle build failing after update to 3.0
Upgrade your gradle build tools to the latest version.
One easy way to do this is to add the latest version of the build tools as a dependency in your build.gradle
file, for example:
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0-beta1'
}
You can then run gradle tasks
and gradle will download everything you need.
After Android Studio 2.2 stable released on Sep 19 2016 , the latest version of the build tools is 2.2.0 . So you can fix it by :
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
}
As Android Studio 2.4 stable is not ready to release yet (May 4 2017), the latest stable version of build tools is 2.3.1 .
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
}
If you update this build tools version to 2.3.* , you should also update gradle wrapper version to 3.3 in /yourProjectRoot/gradle/wrapper/gradle-wrapper.properties file. (i know it is not matching question Gradle build failing after update to 3.0
, but i strongly suggest you to use latest build tool as google recommended)
BTW: version 2.3.1 of build tool is only exist on jCenter, not MavenCentral, so if you run into error below when run gradlew command line in terminal
Could not find com.android.tools.build:gradle:2.3.1.
Searched in the following locations:
https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.3.1/gradle-2.3.1.pom
https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.3.1/gradle-2.3.1.jar
just replace mavenCentral() with jcenter() like
repositories {
jcenter()
//mavenCentral()
}
Related Topics
How to Compare Two Double Values in Java
Java: How to Get a Class Literal from a Generic Type
How to Parse a Local JSON File from Assets Folder into a Listview
Change the System Brightness Programmatically
Sqlite in Android How to Update a Specific Row
Read_External_Storage Permission for Android
Cannot Load R Xlsx Package on MAC Os 10.11
In Java, "5/0" Statement Doesn't Fire Sigfpe Signal on My Linux MAChine, Why
Jaspersoft Studio 6.2 Build Path Warning
Why Is 08 Not a Valid Integer Literal in Java
Why Do I Get "Exception; Must Be Caught or Declared to Be Thrown" When I Try to Compile My Java Code
Replacing a Fragment with Another Fragment Inside Activity Group
How to Add a Textview to Linearlayout in Android
Getting Frames from Video Image in Android
How to Delete Firebase Data After "N" Days
Rjava Install Error "Java_Home Cannot Be Determined from the Registry"