99

After update Android Studio to latest version (3.1) and gradle version in my project I get an error (the link is always different):

12:54   Gradle sync started

12:56   Gradle sync failed: Could not HEAD 'https://jcenter.bintray.com/com/android/tools/analytics-library/shared/26.1.0/shared-26.1.0.jar'. Received status code 502 from server: Bad Gateway             Consult IDE log for more details (Help | Show Log) (1m 56s 602ms)

12:56   Gradle sync started

12:57   Gradle sync failed: Could not HEAD 'https://jcenter.bintray.com/org/codehaus/mojo/animal-sniffer-parent/1.14/animal-sniffer-parent-1.14.pom'. Received status code 502 from server: Bad Gateway             Consult IDE log for more details (Help | Show Log) (1m 4s 266ms)

12:58   Gradle sync started

12:59   Gradle sync failed: Could not HEAD 'https://jcenter.bintray.com/com/sun/activation/all/1.2.0/all-1.2.0.pom'. Received status code 502 from server: Bad Gateway          Consult IDE log for more details (Help | Show Log) (1m 29s 985ms)

13:01   Gradle sync started

13:02   Gradle sync failed: Could not HEAD 'https://jcenter.bintray.com/com/sun/activation/javax.activation/1.2.0/javax.activation-1.2.0.pom'. Received status code 502 from server: Bad Gateway            Consult IDE log for more details (Help | Show Log) (4s 976ms)

Android Studio version:

Android Studio 3.1
Build #AI-173.4670197, built on March 22, 2018
JRE: 1.8.0_152-release-1024-b02 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0

I already tried clean rebuild and update gradle, restart Android Studio and PC, but without success. Any ideas?

PS: of course I have internet. Also, if you open a link in the browser - the file is downloaded.

Mikhail
  • 2,612
  • 3
  • 22
  • 37

9 Answers9

82

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/

Gustavo Pagani
  • 6,583
  • 5
  • 40
  • 71
  • 3
    Today there is no issue. "Identified - There is an intermittent download failures due to an issue with CDN provider. CDN provider is investigating the issue. Mar 17, 21:29 UTC" This issue occurred on Mar 17 not today. – Hafiz Waleed Hussain Mar 27 '18 at 11:06
  • 2
    They have updated the system status now – MatPag Mar 27 '18 at 14:49
  • 2
    Intermittent download issues in Bintray is detected (Y) – Ashik Azeez Mar 21 '19 at 09:04
  • 3
    While the outage is happening, this can be done: Android Studio -> Preferences -> Build, Execution, Deployment -> Gradle -> Check "Offline Work". – Augusto Carmo Mar 21 '19 at 09:18
  • It is having issues for Europe right now.. :( But I was persistent - I kept running `react-native run-android` until everything was installed ':D – Aleksandar Nov 12 '19 at 13:22
  • Who's here in March 2021? – Joshua Pinter Mar 16 '21 at 19:22
  • Who's here in December 2021?? – Stevvxn Dec 30 '21 at 07:53
  • 6
    Still 502 in Jan 2022 – Sambhav Khandelwal Jan 12 '22 at 16:47
  • 1
    when will it get fixed – Sambhav Khandelwal Jan 12 '22 at 16:52
  • 502 for https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-reflect/1.3.72/kotlin-reflect-1.3.72.pom here. but only from my github action – Scott McAllister Jan 12 '22 at 18:05
  • Getting same issue since evening.. Does any one have a permanent solution for this problem? – Sateesh Yemireddi Jan 12 '22 at 18:16
  • Getting this today also, and even this answer's linked status site gives 502 currently when navigated to. `Could not HEAD 'https://jcenter.bintray.com/com/facebook/android/facebook-android-sdk/maven-metadata.xml'. Received status code 502 from server: Bad Gateway` https://jcenter.bintray.com/com/facebook/android/facebook-android-sdk/maven-metadata.xml gives 502 error currently. The solution is to wait until the host of this jcenter bintray website figures out and resolves their issue. – Tommy Elliott Jan 12 '22 at 18:28
  • 1
    Upon further research, JCenter and Bintray in early 2021 announced their package hosting would be removed completely as package sources, and anything using such a package source will need to find another package host to get that package from by Feb 1st 2022. The announcement is at https://jfrog.com/blog/into-the-sunset-bintray-jcenter-gocenter-and-chartcenter/ . **However**, that announcement has a more recent update at the top that states `UPDATE 4/27/2021: We listened to the community and will keep JCenter as a read-only repository indefinitely.`. – Tommy Elliott Jan 12 '22 at 18:57
  • After communicating with someone from JFrog, it seems that Bintray has been fully and permanently decommissioned, while JConnect should still be available indefinitely as a readonly repository. – Tommy Elliott Jan 12 '22 at 23:01
  • we have multiple repositories. why would it fail and halt completely instead of switching to the next one... – dtc Jan 12 '22 at 23:58
  • JFrog seems to have resolved this issue (for JCenter) as of this morning (1/13/22). I was able to again access the package I needed to from JCenter in my build process. @SambhavKhandelwal It might be worth checking again today. – Tommy Elliott Jan 13 '22 at 20:44
  • yeah, works fine! – Sambhav Khandelwal Jan 14 '22 at 04:34
  • Anybody else having trouble again today (Jan 17 2022)? – Joshua Pinter Jan 17 '22 at 17:01
  • Yes I have the exact same issue today. – adi ohaion Jan 17 '22 at 17:05
  • @adiohaion Okay, thanks for confirming. At least it's not just me. This wasn't a problem I wanted to solve today... FFS. – Joshua Pinter Jan 17 '22 at 17:18
  • Its ok now, managed to compile. – adi ohaion Jan 18 '22 at 08:52
40

After updating the Android Studio to 3.1.0 ,

I just had the same problem, i resolved it using

 maven {   url "https://maven.google.com"  }

to the TopMost buildScript like this in project-level gradle :-

 buildscript {
    repositories {
      .....
      ...
     maven {   url "https://maven.google.com"   }

For reference take a sample of the project-level gradle:-

buildscript {

  repositories {
      google()
      jcenter()
      maven { url 'https://maven.fabric.io/public' }
      maven { url 'https://jitpack.io' }
      mavenCentral()
      maven { url 'https://maven.fabric.io/public' }
      maven {  url "https://maven.google.com"  }
  }
 dependencies {
     classpath 'com.android.tools.build:gradle:3.1.0'
     classpath 'io.fabric.tools:gradle:1.24.4'
   }
}

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

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

Note :- One more thing:-

In gradle-wrapper.properties use this :-

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

Instead of 4.1-all.zip .

Edit :- If you want to resolve the issue fast , you can also try adding these - according to Omar's answer :-

 maven { url "http://dl.bintray.com/riteshakya037/maven" }

along with

  maven { url "https://maven.google.com" }
Santanu Sur
  • 10,997
  • 7
  • 33
  • 52
9

Thanks to everyone for the quick answers!

It seems like temporary network issues on the "jcenter.bintray.com" website. I just clicked "Try Again" many times and in the end everything was updated.

Also, if you open the links in the browser - from time to time you will receive a "Service Error" message. So the problem is not on your side.

Dima
  • 394
  • 3
  • 10
Mikhail
  • 2,612
  • 3
  • 22
  • 37
9

Tip:
When you get your project to build correctly the once enable offline-mode so AS don't have to connect to jcenter every gradle refresh.

enter image description here

humazed
  • 74,687
  • 32
  • 99
  • 138
  • 1
    Wow I don't know what I would have done if this didn't work. What a disaster this android studio and gradle/maven stuff is. Such a crappy build platform. – dcarl661 Oct 31 '22 at 16:10
8

Ok, I slove it by:

In your build.gradle project level, add this:

buildscript {
    ...
repositories {
    google()
    jcenter()
    maven { url 'https://maven.fabric.io/public' }
    maven { url 'https://jitpack.io' }
    mavenCentral()
    maven { url "https://maven.google.com" }
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.1.0' // Updated from 3.0 to 3.1.0

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

Note that I've updated gradle from 3.0 to 3.1.0

Next: add the same previous links to allprojects's repository body:

allprojects {
repositories {
    google()
    jcenter()
    mavenCentral()
    maven { url 'https://jitpack.io' }
    maven { url "https://maven.google.com" }
    maven { url 'https://maven.fabric.io/public' }
}

}

One more thing:

In gradle-wrapper.properties use this :

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

After that, just sync again, and it will work.

Pedro Massango
  • 4,114
  • 2
  • 28
  • 48
3

For me after applying Santanu Sur's answer The error hapenned again but with another library I have check project's gradle and I found this line maven { url "http://dl.bintray.com/riteshakya037/maven" } in

allprojects {
    repositories {
        maven { url "http://dl.bintray.com/riteshakya037/maven" }
        maven { url "https://jitpack.io" }
        jcenter()
        google()
    }
}

I deleted it, and everything is good now

Omar HossamEldin
  • 3,033
  • 1
  • 25
  • 51
  • Thanks, I solve it with the code ` maven { url "http://dl.bintray.com/riteshakya037/maven" }` – N.bin Mar 21 '19 at 10:23
  • This link is Forbidden now. Any fix for that. I'm using "http://dl.bintray.com/lukaville/maven". But it is also forbidden and fails to build. @N.bin – user7418129 May 13 '21 at 05:50
2

I've just clicked Disable Gradle 'offline mode' and sync project and Android Studio downloaded all the needed files.

unipin
  • 259
  • 1
  • 3
  • 13
1

It's a server response error. Keep trying by pressing "Try Again" after some time. It will be ok automatically.

1

Uninstalling and Download & install from Developer site solved the issue for me.