why would it not use the latest everywhere? by lat...
# gradle
u
why would it not use the latest everywhere? by latest im mean the largest of declared versions
I dont follow. If I have dependencyA which depends on appCompat 28.0.0 and dependencyB which depends on appCompat 27.1.1,
I run
dependencies
and in the graph its does a * or something or arrow of 27.11 -> 28.0.0, something along those lines of overriding the older version to new, automatically...
Copy code
+--- androidx.lifecycle:lifecycle-extensions:2.0.0
|    +--- androidx.lifecycle:lifecycle-runtime:2.0.0 (*)
|    +--- androidx.arch.core:core-common:2.0.0 (*)
|    +--- androidx.arch.core:core-runtime:2.0.0
|    |    +--- androidx.annotation:annotation:1.0.0
|    |    \--- androidx.arch.core:core-common:2.0.0 (*)
|    +--- androidx.fragment:fragment:1.0.0
|    |    +--- androidx.core:core:1.0.0 -> 1.0.1 (*)
|    |    +--- androidx.legacy:legacy-support-core-ui:1.0.0
|    |    |    +--- androidx.annotation:annotation:1.0.0
|    |    |    +--- androidx.core:core:1.0.0 -> 1.0.1 (*)
isnt this what I think?
g
This is not "using latest", this is dependency resolution rule of Gradle, but dependencies have static versions
Sorry, maybe I misunderstood your message, I thought that you talking why not use latest version with wildcard
u
no no, its okay, my question was why is "exclude" sometimes necessary, if gradle can do the above. I get it its excluding the transitive dependency if I dont want it, but 99% of the time, it is used because of some kind of versions conflict -- but what versions conflict, if gradle can bump it as again above?
g
There are many different cases. For example if you have different versions in different configurations (for example compile and testCompile), in this case Gradle cannot choose one of them Or you just want to exclude dependency, sometimes transitive dependency just not used in your case Also you may have problems if some dependency part of your project (hacked version) and you exclude it to avoid multiple classes on classpath
u
kk, thanks