Amritansh
02/22/2021, 6:49 PMcompileKotlinMetadata
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
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
internal object DatabaseDispatcher : BackgroundDispatcher {
@ExperimentalCoroutinesApi
private val dbThread by lazy { newSingleThreadContext("database") }
@ExperimentalCoroutinesApi
override fun invoke(): CoroutineContext = dbThread
}
I am using these dependendies
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 likeMayank
02/23/2021, 5:59 PM1.4.2-native-mt