https://kotlinlang.org logo
t

tylerwilson

07/30/2021, 2:46 PM
Ugh, this is frustrating! I am trying to update to latest Ktor, serialization and/or coroutines in my shared KMM module. This combo works:
Copy code
val kotlinVersion = "1.5.21"
val coroutinesVersion = "1.5.0-native-mt"
val ktorVersion = "1.6.1"
val serializationVersion = "1.2.1"
if i try to update any of them (1.5.1-native-mt, 1.6.2 or 1.2.2), then the linkDebugFrame taks will either fail silently (create an empty klib folder) or spit out the error below, depending on the target (I have it set up for android, jvm, ios, watchos and macos). Using latest AS Arctic Fox with latet Kotlin 1.5.21 plugin.
Copy code
w: skipping /Users/tylerwilson/.gradle/caches/modules-2/files-2.1/io.ktor/ktor-client-serialization-iosx64/1.6.2/681f93a891846267e5050007bc41a01e459dbe74/ktor-client-serialization.klib. Incompatible abi version. The current default is '1.4.2', found '1.5.0'. The library produced by 1.5.20 compiler
e: Could not find "/Users/tylerwilson/.gradle/caches/modules-2/files-2.1/io.ktor/ktor-client-serialization-iosx64/1.6.2/681f93a891846267e5050007bc41a01e459dbe74/ktor-client-serialization.klib" in [/Users/tylerwilson/Projects/salonbiz-stylist-android, /Users/tylerwilson/.konan/klib, /Users/tylerwilson/.konan/kotlin-native-prebuilt-macos-1.5.10/klib/common, /Users/tylerwilson/.konan/kotlin-native-prebuilt-macos-1.5.10/klib/platform/ios_x64]
Can anybody help????
r

russhwolf

07/30/2021, 3:18 PM
It's looking in
~/.konan/kotlin-native-prebuilt-macos-1.5.10
so make sure you actually are using kotlin 1.5.21.
t

tylerwilson

07/30/2021, 3:21 PM
Yes, I saw that too. But it works when I use the versions shown above. I do have the 1.5.21 plugin, and I have this block in settings:
Copy code
resolutionStrategy {
        eachPlugin {
            if (requested.id.namespace == "com.android") {
                useModule("com.android.tools.build:gradle:7.0.0")
            }
            when (requested.id.id) {
                "kotlin-multiplatform", "org.jetbrains.kotlin.multiplatform", "org.jetbrains.kotlin.native.cocoapods" ->
                    useModule("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.21")
                "kotlinx-serialization", "org.jetbrains.kotlin.plugin.serialization" ->
                    useModule("org.jetbrains.kotlin:kotlin-serialization:1.5.21")
            }
        }
    }
and this block in build:
Copy code
plugins {
    id("com.android.library") //version "4.2.2"
    kotlin("multiplatform") //version "1.5.21"
    //kotlin("native.cocoapods")
    kotlin("plugin.serialization") //version "1.5.21"
    id("com.chromaticnoise.multiplatform-swiftpackage") version "2.0.3"
}
note the versions are commented out since that then breaks everything.
r

russhwolf

07/30/2021, 3:26 PM
Yeah that seems weird, then. What happens if you remove the multiplatform-swiftpackage plugin? I don't know what that's built with off-hand so maybe it's pulling in an older version somehow.
t

tylerwilson

07/30/2021, 3:28 PM
I renamed that .konan 1.5.10 dir and it then downloaded it again. This lib is included in an app project that is using 1.5.10 (it uses Compose, and so has to be). Perhaps gradle is somehow looking in that project somehow. I am running librarylink… so I would not expect. Testing it by changing that kotlin version temporarily
I really do not gradle…
Maybe it is AS getting involved somehow. Changing the app level kotlin version appears to have worked. Will continue testing…
So close. So the individual bits build, now but when I try the XCFramework task, it fails (after 15 minutes of build time [mostly linking[) with this issue https://github.com/ge-org/multiplatform-swiftpackage/issues/36
3 Views