Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"JCenter is at end of life" android lint warning, what is the replacement?

Android Studio Arctic Fox Canary 8 started to warn that JCenter is at end of life

enter image description here

But I cannot just delete jcenter() declarations since it hosts a lot of android artifacts, it would lead to Could not resolve all artifacts error. What is the right way to solve this warning?

like image 650
Valeriy Katkov Avatar asked Feb 27 '21 15:02

Valeriy Katkov


People also ask

What can I use instead of JCenter Android?

To fully migrate away from jcenter() , all we need to do is replace all jcenter() occurrences with mavenCentral() in all build. gradle files. This will ensure all dependencies for every build type are downloaded again.

Why is JCenter shutting down?

Your build may be affected by this shutdown in several ways: Gradle may not be able to download the dependencies used to compile, test or run your code. Gradle may not be able to download the dependencies used by plugins to configure your build.

What is JCenter () in android studio?

JCenter Android. jCenter is the public repository hosted at bintray that is free to use for open source library publishers. It is the largest repository in the world for Java and Android OSS libraries, packages and components. All the content in JCenter is served over a CDN, with a secure HTTPS connection.


1 Answers

There's a documentation section describing the problem: JCenter deprecation and end of service. You can find the link by expanding the inspection description (Ctrl+F1). The documentation states:

JFrog, the company that maintains the JCenter artifact repository used by many Android projects, recently announced the deprecation and upcoming retirement of JCenter. According to the announcement, JCenter will allow downloads of existing artifacts until February 1, 2022.

Developers who publish artifacts on JCenter should start migrating their packages to a new host, such as Maven Central.

In the near future, we will provide additional information about migrating Android projects away from JCenter on this page.

The expanded inspection description (as well as the documentation above) suggests to replace jcenter() by mavenCentral(). Acually JCenter is a superset of Maven Central, but such a replacement won't resolve the problem until all JCenter artifacts your project uses will be moved to Maven Central.

I think the optimal solution would be to wait until the libraries you're using are moved from jcenter() and try to replace it with mavenCentral(). If some artifacts are still missing, take a look at the documentation, may be they are moved into another repository and you should add it to the repositories list as well.

repositories {     google()  //  jcenter()       // <- removed     mavenCentral()  // <- added } 

If you're a library author you should migrate to another repo, probably it would be Maven Central. Note that according to the JCenter deprecation announcement new submissions are allowed only until March 31st 2021.

A few related resources:

  • The jCenter & Bintray is Shutting Down. Now What?
  • Migrating away from JCenter
like image 108
Valeriy Katkov Avatar answered Sep 24 '22 15:09

Valeriy Katkov