I can’t resolve this two imports `import kotlinx.c...
# multiplatform
j
I can’t resolve this two imports
import kotlinx.coroutines.newSingleThreadContext
and
import kotlinx.coroutines.runBlocking
even though I added the
native-mt
version of coroutines. Am I missing something?
Copy code
val commonMain by getting {
    dependencies {
        implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.1-native-mt")
    }
}
val commonTest by getting {
    dependencies {
        implementation(kotlin("test"))
        implementation(kotlin("test-common"))
        implementation(kotlin("test-annotations-common"))
        implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.1-native-mt")
    }
}
g
Those are JVM methods, not accessible on other platforms afaik. EDIT: not sure about that anymore, "native" is visible here and here, so I may have run into the same issue 🤔
j
newSingleThreadContext
should be accessible since I can see
ThreadPoolDispatcher.kt
in my dependencies where
newSingleThreadContext
is declared. I don’t understand why the IDE complains
I created a new kotlin multiplatform project with the same dependencies and it does not complain about anything. I did try to invalidate the cache in the project failing but it didn’t help
I figured out I had other issues even though the compiler was not complaining about it. It seems to work now after fixing those problems
👍 1