Issue
At the project level, the Gradle file of an android project contains google() and mavenCentral() inside the repository block.
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.0"
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I have read a related answer Difference between google() and maven { url 'https://maven.google.com' }, but it doesn't describe about mavenCentral(). That answer is based on google() as a replacement of maven { url 'https://maven.google.com' }. But in my case google() and mavenCentral() both are used alongside.
Solution
They're different Maven artifact repositories, hosted by different entities, with different purposes.
google()
is Google's official Maven repository, where we host Google first-party libraries. This includes the AndroidX libraries, Jetpack Compose, Firebase, Play Services, Material, etc. You can browse what's hosted there online here.
Maven Central is hosted by Sonatype, and allows anyone to upload their projects' artifacts to it. You can read about how to publish there here and search the repository here.
Answered By - Ryan M
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.