Moderator Note: This appears to be a service outage. Stack Overflow cannot provide support for this issue
> Failed to list versions for com.google.http-client:google-http-client-android.
> Unable to load Maven meta-data from https://jcenter.bintray.com/com/google/http-client/google-http-client-android/maven-metadata.xml.
> Could not HEAD 'https://jcenter.bintray.com/com/google/http-client/google-http-client-android/maven-metadata.xml'.
> Read timed out
I was trying to build an Android app, but I got the above error. When I connect to “https://jcenter.bintray.com/com/google/http-client/google-http-client-android/maven-metadata.xml”, an nginx 403 error appears. Is JCenter down? What should I do?
There is yet another incident. Follow the incident here
Yes. JCenter is down right now. But there is a way to fix the issue. JCenter was sunset a while ago and remained available in read-only mode. So far there isn't any update on when it will be available again. Depending your situation, you have quick or not so-quick options for you.
New incident is reported here. Check this out.
As @Adrian mentioned in a comment, you can check the status of the current incident on Gradle's incident status page. The status shows "Resolved", but I still can’t make the project. So I wonder if that status page just shows the impact of JCenter on Gradle Plugin Portal and not the status of JCenter in general.
Now that incident is resolved by updating gradlePluginPortal to serve as JCenter mirror (almost), it's highly possible that adding following repositories before jcenter()
should resolve the issue:
google()
mavenCentral()
gradlePluginPortal()
Toggle offline mode of Gradle as shown below. This will work for the local machine, but it won’t work for CI though.
It's always a good idea to move away from a deprecated service. Most active libraries are now hosted on other popular repositories like the Google repository, Maven Central or the Gradle plugin repository.
To add those repositories in your project, add following in repositories block (you might already have those). Order matters. Make sure to put them before jcenter()
this tells Gradle to look into other repositories before trying to pull from jcenter()
.
Tip: Do a global search for jcenter()
and ensure every repository block that contains jcenter()
has these other repositories.
repositories {
...
google()
mavenCentral()
gradlePluginPortal()
jcenter()
...
}
Do Gradle sync and clean build and see if that works.
Don't worry (yet). This is common. The above solution won’t work alone for some situations:
When moved from jcenter()
to other repository (like mavenCentral()
), authors decided to update the version number. This simply means you need to update the version of that dependency to fetch it from other repository. Look for the library that shows up as unavailable in failed build log. Find its GitHub or development documentation to check the latest version. Gradle Sync + clean build.
The repositories that we just added are popular ones, but they are not the only ones. When authors of library had to switch from JCenter to somewhere else, they did not choose one of these. In such cases, check the GitHub page or developers documentation. Usually authors put the required repository on those pages. If you find that repository is not present in your project, add it. Gradle Sync + clean build.
jitpack.io
largely because it was quick and easier than others. But you should be aware of concerns with that. Melix from Gradle summarizes the concerns with jitpack.io. Because of potential security issues, I recommend to consult team and security expert before adding that.Well, now it's time for little worry. It's highly possible that you are using some library that is deprecated or no longer maintained. Find GitHub page of the library and see if author declared it deprecated or no-longer maintained in readme. You can even check when it got last commit. If it was a while ago, it means it's no longer maintained and author did not care to move library from jcenter()
to any other repo.
jcenter
. If you are in luck, someone might even have created fork and hosted that fork somewhere else. For example, I use spanny
in one of the projects and author did not move it. GustavoRoss cared enough to fork and move.But hey, I don't remember putting library in question in my code base? This means, it's a transitive dependency (a dependency of your direct dependency). Again check, latest version of your direct dependency and hopefully new version has fixed this.
How can I check a direct and transitive dependency?
Hopefully by this point you got the build working. If not, then hope for JCenter to come back soon and start planning to move away from it.