https://kotlinlang.org logo
Title
t

Tigran Barseghyan

05/12/2023, 2:40 PM
Hi all, TL;DR > how to use Kotlin Multiplatform Library with 3rd party dependencies in a non-multiplatform application? my goal is to build a shared library for existing Android and iOS apps, so I chose Library project over KMM it uses ktor client (tried with CIO engine) to make API calls and the generated artifact (JAR) is included into an Android app however when using it there's a runtime exception about CIO implementation not being found, as it is missing from the JAR file in my understanding the Android app shouldn't be aware of the libraries the Multiplatform Library uses, so I don't want to include them explicitly instead everything should have been included in the JAR file IMHO am I missing something here? I couldn't find any resources online about this particular situation
j

Jeff Lockhart

05/12/2023, 4:19 PM
How are you declaring dependencies in build.gradle.kts?
Also, do you have Java 8 API desugaring enabled?
android {
    ...
    compileOptions {
        isCoreLibraryDesugaringEnabled = true
    }
}
That's necessary to support Android versions before 7.
t

Tigran Barseghyan

05/12/2023, 5:17 PM
thank you Jeff! actually this was solved by publishing the artifacts, instead of just doing
gradle build
publishing the artifacts results to proper files and libraries being pushed to maven still not sure how to achieve that without publishing, but that's not a big problem now