The last time I used Android Studio, it generated .gradle
files with mavencentral()
buildscript repositories whereas now there's jcenter()
.
Could anyone explain the issues connected with this. Are there any other repos? When should we switch them? What impact do they have on projects, modules, libs? Any other essentials for Android developers?
Who's responsible for maintaining those repos?
Jcenter is a superset of mavenCentral, including many additional jars. Jcenter performance is better than mavenCentral. mavenCentral will automatically download many IDE-related indexes, and these are used less often which are not required.
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.
JCenter will no longer be available for non-Artifactory clients. This means by the end of March 2021, publishing new packages to Bintray will no longer be allowed. Existing packages can still be downloaded until February 1st 2022.
At Bintray I just rebloged a very detailed blog post describing the reasons why Google made this change. Here are the most important points:
jcenter()
is a superset of mavenCentral()
, that encompasses many additional repositories and artifacts.Regarding performance improvements, couple of android developer advocates had faced/noticed the issue of huge indexing with maven central.
In the words of Tor Norbye:
I ran AndroidStudio with a brand new settings directory, so it went and connected maven central and downloaded an index of the available artifacts.
Then I happened to look at the size of my directory.
My ~/Library/Cache/AndroidStudioPreview is 1.5G, and 1.2G of those are taken by the “Maven” subdirectory.
That’s ridiculous. We barely use the index at all. The primary use for it is the Dependency editor in the Project Structure Dialog, but we really don’t need to have a precomputed index for it. MavenCentral has a fast online JSON search we can use on demand when somebody searches for artifacts. In https://android-review.googlesource.com/#/c/94843/ we added a lint check which checks whether the dependencies are up to date, and the search for a handful of artifacts is near instant.
In short, we really don’t need the cache; it may help with code completion in .gradle and maven .pom files, but that’s not a super important usecase, and certainly not something all users should have to sacrifice 1.5G of download speed and diskspace to have the possibility of one day doing. Read more on: The Maven index is huge!
Also, you might find this very short (1Q and 1A) discussion on Hacker News interesting.
I am with JFrog, the company behind bintray and artifactory, see my profile for details and links.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With