jcenter.bintray.com is down Error: 502 Bad Gateway [closed]
Asked Answered
L

8

61

When trying to build my project I am getting the following error:

Could not GET
'https://jcenter.bintray.com/androidx/lifecycle/lifecycle-common/maven-metadata.xml'.
Received status code 502 from server: Bad Gateway

  • In my build.gradle repositories I don't have JCenter, so this error I'm getting is from dependencies that are still pointing to JCenter.
  • Gradle offline mode is not the solution I'm expecting.
  • I know that JCenter is down and that we should all move to Maven Central (I already did)

Is there a workaround?

Luminary answered 12/1, 2022 at 19:27 Comment(2)
Postmortem document -> blog.gradle.org/plugins-jcenter. "Strengthening your build infrastructure" is the important section.Luminary
Supplementary, from an answer: "2022-02-01 - JCenter will be completely shut down." (that is 20 days after this question was posted)Adowa
B
47

It's a global outage in JCenter. You can monitor status at https://status.gradle.com. It replaces the bintray status page which seems is now fully sunset and returns a 502 error.

UPDATE Jan 13, 06:35 UTC

JCenter is now back online, and systems are fully operational.

UPDATE Jan 20

Gradle Plugin resolution outage postmortem

https://blog.gradle.org/plugins-jcenter

Following this incident, the Gradle Plugin Portal now uses a JCenter mirror hosted by Gradle instead of JCenter directly. This should shield users from short JCenter outages for libraries that have been cached by the mirror. We saw another short outage of JCenter over the weekend and this did not appear to impact Gradle Plugin Portal users.

Balfore answered 12/1, 2022 at 19:42 Comment(2)
This actually doesn't answer the question being posted since the author mentions that he knows the site is down.Subsistence
I would suggest replacing each jcenter() in android/build.gradle with either mavenCentral() or gradlePluginPortal() (I needed the latter)Transmute
U
19

JFrog, the maintainers of JCenter, announced that they are sunsetting JCenter. This means the following for Android developers for their app's dependencies:

  • March 31st 2021 - Libraries in JCenter will no longer be updated.
  • February 1, 2022 - JCenter will be completely shut down.

Add Maven Central to your project:

  1. Open your root build.gradle
  2. Find lines that say jcenter() and replace them with mavenCentral() (Make sure to add mavenCenteral() in both spots where jcenter() is found.)

.

    // Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        google()
        mavenCentral() // New line
        // jcenter()
       // NOTE: Keep any other entries you may have had here
    }
    dependencies {
        classpath "com.android.tools.build:gradle:4.1.2"
        //... no changes here
    }
}
allprojects {
    repositories {
        google()
        mavenCentral() // New line
        // jcenter()
       // NOTE: Keep any other entries you may have had here
    }
}

You can find more here: https://blog.gradle.org/jcenter-shutdown

Unmentionable answered 12/1, 2022 at 23:42 Comment(4)
Actually, JCenter update that Feb 2022 shutdown info by keeping JCenter as a read-only repository indefinitely: blog.gradle.org/jcenter-shutdown Official announcement here: jfrog.com/blog/…Paleontology
Whether Jcenter will be available read-only post 31st Jan 2022.Richella
I didn't remove jcenter(), but I added mavenCentral() and it helped. ThanksIndicative
I had to replace jcenter() with gradlePluginPortal() instead, to support one of the (unmaintained) libraries which didn't migrate to mavenCentral() yet apparentlyTransmute
I
8

JCenter mentioned it was no longer going to work for new packages starting March 2021, something like that, but it was going to work indefinitely for read-only purposes. It seems right now it is down, but it should get back up sooner rather than later (crossing fingers).

Reference:

Into the Sunset on May 1st: Bintray, GoCenter, and ChartCenter

Incompressible answered 12/1, 2022 at 21:53 Comment(0)
D
3

I am facing the same issue. Using maven { url 'https://maven.aliyun.com/repository/jcenter' } instead of jcenter in the build.gradle file might resolve the issue, but it's not recommended since it's unofficial.

Dunkle answered 12/1, 2022 at 23:9 Comment(2)
how do you do that? what files do you change? Thanks in advance.Waste
U can change it in your build.gradle file. Just replace jcenter with the line above, but I would still not recommended it since this is a clone repo and may contain toxic libs.Dunkle
D
3

This issue affected my Jenkins patching (due to the script trying to grab job-dsl-core from JCenter), so I ended up replacing jCenter() with gradlePluginPortal() in file build.gradle, and all is working fine now.

Diachronic answered 13/1, 2022 at 2:41 Comment(1)
This was the solution that worked for me as wellTransmute
F
1

I had the same issue today. Since JCenter is being deprecated, we decided to move away from it now.

The problem I found is that the list of repositories used for Gradle plugins is different from the one you use to compile/run your application. Besides removing it from the repositories for your compile/runtime dependencies, you will also need to force Gradle to not use it for plugins. I added the following to my settings.gradle.kts file:

pluginManagement {
    repositories {
        mavenCentral()
        gradlePluginPortal()
    }
}

See Custom Plugin Repositories.

Fulgor answered 12/1, 2022 at 21:10 Comment(0)
V
1

There was a fall. You can see the status at https://status.gradle.com/.

If you still need to compile your application (but you had already compiled it before), it may be that you have the packages in cache. Deactivate the Internet connection, disconnect the plug, turn off the device you have, enp3s0, eth0, etc. or if you use Android Studio compiling offline.

If your application uses services from your local or external network, after the compilation reconnect to the Internet and everything will work fine. Now, if you have not compiled it before, or you cleared the cache, that is, it is a new application, I have seen several procedures, but none worked for me, just pray.

Vignola answered 12/1, 2022 at 23:41 Comment(3)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Warmedover
What do you mean by "There was a fall."?Adowa
What I said, there was a crash, I don't think there is a need to explain more, the repositories where some packages were downloaded when compiling could not be downloaded, since the same repository was offlineVignola
B
0

Some third-party libraries uses JCenter as repository, but we can override it easily. To do it you just need to create a file called init.gradle.kts inside /android directory (if it is a React Native project) with the following code:

apply<EnterpriseRepositoryPlugin>()

class EnterpriseRepositoryPlugin : Plugin<Gradle> {
    companion object {
        const val ENTERPRISE_REPOSITORY_URL = "https://repo.gradle.org/gradle/repo"
    }

    override fun apply(gradle: Gradle) {
        gradle.allprojects {
            repositories {

                all {
                    if (this !is MavenArtifactRepository || url.toString().contains("jcenter")) {
                        project.logger.lifecycle("Repository ${(this as? MavenArtifactRepository)?.url ?: name} removed.")
                        remove(this)
                    }
                }

                // add the enterprise repository
                add(maven {
                    name = "STANDARD_ENTERPRISE_REPO"
                    url = uri(ENTERPRISE_REPOSITORY_URL)
                })
            }
        }
    }
}

Then, you just need to clean gradlew and build again using:

./gradlew assembleRelease --init-script init.gradle.kts
Bagwig answered 12/1, 2022 at 22:18 Comment(3)
Getting this on my side (react-native 0.65.1), when running gradlew with your suggested init script: Could not determine the dependencies of task ':app:lintVitalRelease'. > Could not resolve all artifacts for configuration ':app:debugCompileClasspath'. > Could not find :ScanditBarcodeScanner:. Required by: project :app > project :scandit-react-nativeCourtund
try npx jetify first, if the error persists this library dependency may not available on maven.Bagwig
finally replacing jcenter() by gradlePluginPortal() in my build.gradle: allProjects.repostifories did the trick for me.Courtund

© 2022 - 2025 — McMap. All rights reserved.