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

Amritansh

02/22/2021, 6:49 PM
Hi, my 
compileKotlinMetadata
 task is failing in a KMM project when I run
./gradlew build
and I am getting following error. My app runs and build fine when I use IDE, this error only occurs when I use terminal to build or on my CI
Copy code
DatabaseDispatcher.kt: (4, 27): Unresolved reference: newSingleThreadContext
DatabaseDispatcher.kt: (9, 36): Unresolved reference: newSingleThreadContext
DatabaseDispatcher.kt: (12, 47): Type mismatch: inferred type is Unit but CoroutineContext was expected
This is the class where it is failing
Copy code
internal object DatabaseDispatcher : BackgroundDispatcher {
    @ExperimentalCoroutinesApi
    private val dbThread by lazy { newSingleThreadContext("database") }

    @ExperimentalCoroutinesApi
    override fun invoke(): CoroutineContext = dbThread

}
I am using these dependendies
Copy code
kotlin = "1.4.30"
coroutines = "1.3.9-native-mt-2"
serialization = "1.0.1"
ktor = "1.4.3"
klock = "2.0.0"
benasherUUID = "0.2.3"
stately = "1.1.0"
junit = "4.12"
sqlDelight = "1.4.3"
This is how my
build.gradle
looks like
🙌 1
m

Mayank

02/23/2021, 5:59 PM
Can you try with the latest version of coroutines
1.4.2-native-mt
9 Views