I have a KMP library(for iOS and Android) that is heavily depending on Ktor. Currently everything works fine if my library is using the same version of Ktor that is being used in the project that consumes my library. But as soon as I have different Ktor versions I get crash errors on Android and on iOS like this:
Android:
Uncaught Kotlin exception: kotlin.native.internal.IrLinkageError: Can not get instance of singleton 'Plugin': No class found for symbol 'io.ktor.client.plugins/HttpTimeout.Plugin|null[0]'
Is it possible to enable more flexibility with the library to not demand to have the same Ktor versions on consumer projects?
a
Aleksei Tirman [JB]
09/19/2024, 4:01 PM
Can you share both version numbers?
b
Blaž Vantur
09/19/2024, 4:05 PM
This is my first library and I am not sure what can and can not be done. My library is already published on mavenCentral and it will be included as any other library to the project. is that what you are asking me?
If you are asking which versions do I use in my test, I am using 2.3.6 in my library and 3.0.0-beta-2 in my sample test project.
h
Hristijan
09/19/2024, 7:16 PM
You have different MAJOR versions, some of the things in 2.X aren't compatible with 3.X
☝️ 1
🙌 1
b
Blaž Vantur
09/19/2024, 7:23 PM
Is there a way to make a minimum support of my library to 2.X and support somehow everything up from there? Or should I cut my loses and just say that library works only from for projects that are using 3.X version of Ktor? How is this usually handled? Or should I create 2 artifacts, 1 for 2.X family and one for 3.X family? 😅
p
Pablichjenkov
09/19/2024, 8:34 PM
I would go with the 2 artifacts. Or just the 3.x with a migration path
🙌 1
b
Blaž Vantur
09/20/2024, 7:32 AM
Thank you guys. Will create 2 different artefacts for Ktor 2 and Ktor 3 versions.