I’m trying to introduce KMM to my app project (Android & iOS). I’m forced to use Kotlin 1.6.20-M1.
To provide serialization I experimented with ktor-client-serialization. For the Android target, everything works as expected, but when I try to build the iOS project I get this warning and error:
w: skipping /Users/myuser/.gradle/caches/modules-2/files-2.1/io.ktor/ktor-client-serialization-iossimulatorarm64/2.0.0-beta-1/771eb3adb63f3827785b68532ca6e2ed579e71f/ktor-client-serialization.klib. Incompatible abi version. The current default is '1.5.0', found '1.6.0'. The library produced by 1.6.0 compiler
e: Could not find "/Users/myuser/.gradle/caches/modules-2/files-2.1/io.ktor/ktor-client-serialization-iossimulatorarm64/2.0.0-beta-1/771eb3adb63f3827785b68532ca6e2ed579e71f/ktor-client-serialization.klib" in [/Users/myuser/development/myapp/IOS/Pods, /Users/myuser/.konan/klib, /Users/myuser/.konan/kotlin-native-prebuilt-macos-aarch64-1.5.31/klib/common, /Users/myuser/.konan/kotlin-native-prebuilt-macos-aarch64-1.5.31/klib/platform/ios_simulator_arm64]
The only solution I found to this problem was to update the Kotlin version, but in this case I don’t have the possibility to do so.
I added the dependency just like the documentation says.
build.gradle.kts of my shared module:
plugins {
kotlin("multiplatform")
kotlin("native.cocoapods")
kotlin("plugin.serialization") version "1.6.20-M1"
id("com.android.library")
}
...
kotlin {
...
sourceSets {
val commonMain by getting {
dependencies {
implementation("io.ktor:ktor-client-serialization:2.0.0-beta-1")
}
}
}
}