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

jean

09/21/2021, 9:06 AM
I’m trying to tesmsqldelight code the same way it is done there : https://github.com/touchlab/KaMPKit/blob/main/shared/src/commonTest/kotlin/co/touchlab/kampkit/SqlDelightTest.kt but I get the following error. Any idea what I’m doing wrong?
kotlin.IllegalStateException: There is no event loop. Use runBlocking { ... } to start one.
o

Osman Saral

09/21/2021, 9:08 AM
I think you're running ios tests. can you try to change dispatcher to
Dispatchers.Default
?
o

okarm

09/21/2021, 9:31 AM
Ensure that you pull the
-native-mt
dependency on native targets.
Copy code
val iosMain by getting {
    dependencies {
        implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core") {
            version {
                strictly("${Libs.KotlinX.Coroutines.version}-native-mt")
            }
        }
    }
}
j

jean

09/21/2021, 9:34 AM
ah right, i remember commenting here I had an issue with
Dispatchers.Default
and someone answering to not use Main since it’s not available for native, unless using native-mt. I’ll revert to the main dispatcher + native-mt and give it a go, thanks 🙂
j

jean

09/21/2021, 9:35 AM
yes i just checked that, and i am using default right now. So I’ll reverse to using main + native-mt
👍 1
o

okarm

09/21/2021, 9:38 AM
Hopefully in a year from now we'll all be using the new memory model, not worrying about custom forks!
🤞 1
l

leandro

09/22/2021, 12:49 PM
Is it possible to force “native-mt” only for ios? or must calling the strict version be on commonMain’s dependencies?
j

jean

10/20/2021, 7:25 AM
Follow up on this after focusing all my tests pass correctly for android. I still run in the same error. I did set my dependencies for ios as @okarm suggested, but it crashes the build with the following error :
Copy code
Could not resolve all files for configuration ':iosCompileKlibraries'.
   > Could not resolve org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2.
and using native-mt + Main or Default dispatcher still end up in the same
There is no event loop. Use runBlocking { ... } to start one.
error