This message was deleted.
# community-support
s
This message was deleted.
y
@Stylianos Gakis if you want to only depend on lib A : 1.0.0 then you can declare that you strictly depend on version 1.0.0. For example:
implementation("libA:1.0.0!!")
For more details: https://docs.gradle.org/current/userguide/single_versions.html
s
Thanks for that, yeah I can do that in this case, which would mean that if Lib B tries to resolve something which only exists in 1.1.0 then that library would get a runtime crash right? Since it wouldn’t exist as I am forcing 1.0.0. Now I’m already fixing this by bumping everything to 1.1.0, and updating my call-sites too, but I have been trying to figure out how this has happened in the first place and what I can do to avoid getting this issue in the future too. It really feels like I should’ve been getting a compile-time error for this, but I did not. Already have a disussion with someone on the kotlin slack channel, but I don’t think I still understand what’s going on exactly.
y
moving to DM
v
As it is on an open source project, I'd recommend looking at / sharing a build
--scan
. Basically similar information as
dependencies
and
dependencyInsight
provide, but nicer displayed and searchable and with some additional information. In most cases it is easier to investigate in there.
s
https://scans.gradle.com/s/mnnza7duzvtb2/dependencies?focusedDependencyView=dependencies_or_failure&toggled=W1s1XSxbNSw0XSxbNSw0LFs0MzgxXV1d This is the first time I’ve done this, now trying to learn how to navigate myself through there 😄 Looking at the
androidx.compose.material:material:1.4.0-alpha04
in particular. And how in my code I got 1.3.1 (through androidx.composecompose bom2023.01.00), and therefore get no warning that some APIs from in there have changed, but at runtime it’s using 1.4.0-alpha04, and it crashes as one of the function signatures changed in a backwards incompatible way (it’s annotated as experimental so that’s why it was done this way). Not gonna lie, a bit overwhelming to navigate in there for the first time, I wouldn’t say I understand everything that I would like to, but gonna try and spend some more time at it.
v
Yeah, can be a bit overwhelming at first indeed. 🙂
In which of the projects is the class that compiled but should have failed?
v
As you can see at https://scans.gradle.com/s/mnnza7duzvtb2/dependencies?configurationFilter=WyJkZWJ1Z0N[…]ial:&expandAll&focusedDependencyView=dependencies_or_failure, that module does not have 1.4.0-alpha in the transitive deps, to it compiles against 1.3.1. But
app
has 1.4.0-alpha in the transitive deps, so that is what
app
when it assembles everything together ends up with in the runtime classpath.
To get 1.4.0-alpha everywhere (who in the world publishes a dependency on a an alpha version? o_O), you could for example introduce a platform where you define that constraint and then make all your subprojects use that platform, so that you have 1.4.0-alpha everwhere where it is present.
s
Wow, so that is what is happening, I had no idea before experiencing this actually. I always thought the dependency decisions are made on a global level, and then used by all modules. But it does make sense that this decision happens on a module level, so that's why on my own source code it looked fine, but not on runtime. This is certainly new to me, but very important to understand! I will give this a try by making use of this platform feature. Btw from this build scan, can I see where this alpha transitive dependency comes from? I imagine it either comes from another alpha version we may be using, or a library we've made ourselves, which does have some alpha dependencies but we're gonna kill soon anyway, hence it being a bit unmaintained like that. Thank you both for helping out, I appreciate it so much! And thanks for letting me know about this --scan feature, definitely something to try using again in the future 😊
v
You are told about it with every failed build. :-D
s
Haha well, Gradle tells me a ton of things on every failed build. In fact, enough things that my eyes have become blind to things that I see every day and automatically filter out 😅
v
And yes, you can see where it comes from. Click it hover it (don't remember, I'm on mobile) then there appears an icon on the right to display details
thank you 1