Issue
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?
Solution
tldr;
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 no update on when it will be available again. Depending your situation, you have quick or not so-quick options for you.
Where can I check status?
update: New incident is reported here. Check this out.
As @Adrian mentioned in comment, you can check status of current incident on Gradle's incident status page. Update: The status shows "Resolved" but I still cant make the project. So I wonder if that status page just shows impact of jcenter
on Gradle Plugin Portal and not status of jcenter
in general.
So far, I cannot find any place that reports status of bintray anymore. Please comment below if you find one.
What can I do now?
Recommended Update:
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()
Temporary solution:
Toggle offline mode of gradle as shown below. This will work for local machine but wont work for CI though.
Robust solution:
It's always a good idea to move away from a deprecated service. Most active libraries are now hosted on other popular repositories like google repo, Maven Central or gradle plugin repo.
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 repos before trying to pull from jcenter()
.
Tip: Do a global search for jcenter()
and ensure every repository block that contains jcenter()
has these other repos.
repositories {
...
google()
mavenCentral()
gradlePluginPortal()
jcenter()
...
}
Do gradle sync and clean build and see if that works.
That didn't work?
Don't worry (yet). This is common. Above solution wont work alone for some situations:
When moved from
jcenter()
to other repo (likemavenCentral()
), authors decided to update the version number. This simply means you need to update the version of that dependency to fetch it from other repo. Look for the library that shows up as unavailable in failed build log. Find it's github or develop docs to check the latest version. Gradle Sync + clean build.The repositories that we just added are popular ones but 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 github page or developers docs. 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.- Beware: Some authors chose repository options like
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.
- Beware: Some authors chose repository options like
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.- Go to GitHub issues of the repo. Someone must have posted question regarding plan to move from
jcenter
. If you are in luck, someone might even have created fork and hosted that fork somewhere else. For example, I usespanny
in one of the projects and author did not move it. GustavoRoss cared enough to fork and move. - No one forked and moved? Then you have two options.
- Look for an alternate active library that does the same for you. Of course this is time consuming, but again a good idea to move away from deprecated resource.
- If you don't have time to integrate new library or no other library exist, then be the hero and make fork of GitHub project and move.
- Go to GitHub issues of the repo. Someone must have posted question regarding plan to move from
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 to check direct and transitive dependency?
- your failed build log has the answer.
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.
Answered By - HBB20
Answer Checked By - Robin (JavaFixing Admin)