https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
g

GNKumar

04/02/2024, 2:08 PM
HI Everyone, I am trying to Add "io.ktor:ktor-client-core" in Kotlin KMP project without common dependency Implementation Is it possible to add any dependency as .JAR in KMP Project? does it support both iOS and Android if I add it like a .JAR?
w

William Walker

04/02/2024, 3:30 PM
No. In order to be compiled for a source set, a library must be included in that source set’s dependencies or be declared in the common source set with support for that platform you’d like to compile targeting. Directly adding jars is not recommended and will likely cause you problems. Even if you get the right jars, it will not compile right for iOS most likely.
g

GNKumar

04/02/2024, 5:16 PM
Ok, thank you I am trying create a KMP library, In that I added implementation("io.insert-koinkoin core3.2.0") in common set. I am able to generate the library. Next I added in Sample Android project as AAR and Added same dependency in native android gradle otherwise I am getting koin dependency error in Native android App is there any option without adding the library dependencies in native android sample app?
w

William Walker

04/02/2024, 7:34 PM
You need to expose Koin as an api() dependency rather than implementation, if you intend for consuming code to be able to access it as part of your sample android project’s AAR dependency
Check your build.gradle.kts for multiplatform common module
g

GNKumar

04/05/2024, 8:20 AM
HI @William Walker Yes I tried expose Koin as an api(), No use Added jar in lib folder library and removed implementation but import not working , I mean not able to import the koin related class
4 Views