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

Amritansh

02/15/2021, 4:04 PM
Hello, I am running it an issue when trying to build from terminal
Unresolved reference: newSingleThreadContext
. The project builds and run fine if I use Android studio or xcode to run the app. These are all the dependencies which I am using
Copy code
object Versions {

    const val MIN_SDK = 23
    const val COMPILE_SDK = 30
    const val TARGET_SDK = 30

    const val kotlin = "1.4.20"

    const val androidTools = "4.1.1"

    const val coroutines = "1.3.9-native-mt-2"

    const val serialization = "1.0.1"

    const val ktor = "1.4.3"

    const val klock = "2.0.0"

    const val benasherUUID = "0.2.3"

    const val stately = "1.1.0"

    const val junit = "4.12"

    const val sqlDelight = "1.4.3"
}

object Dependencies {
    const val kotlinGradlePlugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.kotlin}"
    const val kotlinSerialization = "org.jetbrains.kotlin:kotlin-serialization:${Versions.kotlin}"
    const val androidTools = "com.android.tools.build:gradle:${Versions.androidTools}"
    const val coroutinesCore =
        "org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.coroutines}"
    const val kotlinxSerialization =
        "org.jetbrains.kotlinx:kotlinx-serialization-core:${Versions.serialization}"
    const val ktorClientCore = "io.ktor:ktor-client-core:${Versions.ktor}"
    const val ktorClientSerialization = "io.ktor:ktor-client-serialization:${Versions.ktor}"
    const val ktorClientAndroid = "io.ktor:ktor-client-android:${Versions.ktor}"
    const val ktorClientIos = "io.ktor:ktor-client-ios:${Versions.ktor}"
    const val klock = "com.soywiz.korlibs.klock:klock:${Versions.klock}"
    const val benasherUUID = "com.benasher44:uuid:${Versions.benasherUUID}"
    const val stately = "co.touchlab:stately-concurrency:${Versions.stately}"
    const val junit = "junit:junit:${Versions.junit}"
    const val sqlDelightGradlePlugin =
        "com.squareup.sqldelight:gradle-plugin:${Versions.sqlDelight}"
    const val sqlDelightCommon = "com.squareup.sqldelight:runtime:${Versions.sqlDelight}"
    const val sqlDelightAndroid =
        "com.squareup.sqldelight:android-driver:${Versions.sqlDelight}"
    const val sqlDelightIOS =
        "com.squareup.sqldelight:native-driver:${Versions.sqlDelight}"
}
output from
./gradlew build --stacktrace
r

russhwolf

02/15/2021, 5:17 PM
newSingleThreadContext
is only available on JVM.
a

Amritansh

02/15/2021, 5:22 PM
@russhwolf based on what is written here, it looks like it is available for native as well https://github.com/Kotlin/kotlinx.coroutines/blob/native-mt/kotlin-native-sharing.md#threads-and-dispatchers
also I have tested it and I was able to switch to a single thread on iOS
5 Views