Let us consider the following section of build.gradle
file
allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}
Although I am not very knowledgable on the exact differences between google()
, jcenter()
and mavenCentral()
- according to this post (Android buildscript repositories: jcenter VS mavencentral) jcenter()
is a superset of mavenCentral()
- thus we can reasonably expect there to be at least some overlap of supported libraries in google()
, jcenter()
and mavenCentral()
.
The question now becomes if a desired repository is found in all 3.
implementation 'some_cool_library_found_in_all_3:1.0.0'
How does gradle know which is the "correct" one to download and install from? Is there some simple heuristic (e.g. go from top to bottom). Or are libraries and versions standardized by some protocol across google()
, jcenter()
and mavenCentral()
- making it irrelevant where we get our library from.