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

Francesco Bonnì

04/11/2022, 12:58 PM
Hello, everyone 🖖, We’ve just updated KMM project to have the same structure as the plugin created (before we did everything manually and was used as a library with publishing on Maven). We’re using kotlinx coroutines native-mt version with the strictly, iOS run smoothly, Android on build give this error:
Copy code
org.gradle.internal.resolve.ModuleVersionResolveException: Could not resolve org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0-native-mt.
We tried to move the strictly on iOSMain and remove it from commonMain, Android run but iOS Crash for runBlocking{} no event loop. Does someone have an idea how to solve it🙏? Thank you
f

Francesco Bonnì

04/11/2022, 2:25 PM
Thank you @pguardiola but we’re trying to avoid the new memory model and prefer using the native-mt version of coroutines.
We solved forcing the native-mt version on resolutionStrategy, now both app run but on android we’re encountering NoClassDefFoundError but I think the problem aren’t related
p

pguardiola

04/11/2022, 2:48 PM
👍
s

Sam

04/12/2022, 6:59 PM
I ran into something similar when using a toml file. This is what worked for me. Note this project wasn’t on 1.6. You should be able to just plug in the new version numbers. I think the key is the prefer part of the version specification. There should be an analogue in plain gradle for this too.
Copy code
[versions]
coroutines = { strictly = "[1.5.2-native-mt, 1.5.2]", prefer = "1.5.2-native-mt" }
[libraries]
coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "coroutines" }
coroutines-jvm = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm", version.ref = "coroutines" }
coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" }
coroutines-rx3 = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-rx3", version.ref = "coroutines" }
f

Francesco Bonnì

04/13/2022, 2:41 PM
Thank you @Sam, I’ll give a shot
4 Views