https://kotlinlang.org logo
Title
u

ursus

12/08/2018, 8:50 PM
why would it not use the latest everywhere? by latest im mean the largest of declared versions
g

gildor

12/09/2018, 1:12 AM
Because it can break your build at any moment, you cannot achive reproducible builds and don't know which version of dependency used by particular version of your app
u

ursus

12/09/2018, 1:34 AM
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...
+--- 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

gildor

12/09/2018, 4:30 AM
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

ursus

12/09/2018, 5:34 PM
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

gildor

12/09/2018, 11:31 PM
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

ursus

12/10/2018, 1:47 AM
kk, thanks