Hi all! I’m using the Ktor MockEngine in the commo...
# multiplatform
h
Hi all! I’m using the Ktor MockEngine in the commonTest but when I run the test units on iOS it says:
Copy code
kotlin.Error: Ktor native HttpClient requires kotlinx.coroutines version with native-mt suffix (like 1.3.9-native-mt). Consider checking the dependencies
I’m currently using this dependency in the commonMain
Copy code
org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0-native-mt
And there is no issue when I run the app on the iOS but when I run test units on the iOS I get the error I mentioned above. How can I fix it?
t
use
org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0-native-mt!!
in your declaration, likely something else specifies
org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0
somewhere which gradle resolves as a higher version.
🙏 1
!!
forces the version
h
Thank you. By forcing the version it says:
Copy code
kotlin.native.concurrent.InvalidMutabilityException: mutation attempt of frozen
@Tijl
Actually by adding
org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0-native-mt!!
to the commonTest the problem fixed but when I build an instance of Ktor in my custom class it says
kotlin.native.concurrent.InvalidMutabilityException: mutation attempt of frozen
but by creating an instance of Ktor directly in the test classes everything works correctly.
h
run
gradle dependencies
to find the upgrading dependency
t
yeah that’s another problem, now you seem to be using the coroutines version you want/need