https://kotlinlang.org logo
#ktor
Title
# ktor
p

ptsiogas

08/02/2022, 10:39 AM
Quick question for mobile client: can I have Ktor version 1.6.7 on a library gradle dependency and Ktor version 2.0.3 on my main project? I have tried it and I realised that those two are not working well together (e.g I got java.lang.NoClassDefFoundError: Failed resolution of: Lio/ktor/client/features/ClientRequestException).
b

Big Chungus

08/02/2022, 10:41 AM
As a rule of thumb, different major versions of the libraries don't play nice together due to permitted breaking changes. Looks like you hit a bottleneck here. I recommend sticking with 1.x for now until your dependencies upgrade to 2.x
Gradle usually resolves to the highest version of the library in the dependency tree, that's why you get NoClassDef exception from your dependency that expects ktor 1.x but gets 2.x
p

ptsiogas

08/02/2022, 10:43 AM
I see, that was my perspective too. I was hoping for a workaround 🙂
b

Big Chungus

08/02/2022, 10:44 AM
Fork the lib and bump the dependency yourself? 😀
😀 1
5 Views