Hi, I am getting this when I try to build `./gradl...
# multiplatform
a
Hi, I am getting this when I try to build
./gradlew :shared:build
my KMM project
Task :shared:compileKotlinMetadata FAILED
and in the stacktrace I am getting this
Unresolved reference: newSingleThreadContext
. I am using kotlin : 1.5.31 and coroutines version
1.5.2-native-mt
. Any idea what might be the issue? I had to comment out
Copy code
#kotlin.mpp.enableGranularSourceSetsMetadata=true
#kotlin.native.enableDependencyPropagation=false
in the gradle.properties since sql delight does not support hmpp. can that be the issue here?
k
I remember getting that error (unfortunately, I've gotten so many errors I can't remember the solution). Right now, I am only able to use Kotlin 1.4.21 not 1.5.x
a
Yeah, I get that. It is the same for me. I have got so many errors now that I don't remember the solutions. I have had this build issue for a while but it does not stop me from actually building the framework file or android .aar file when I run the apps from xcode or androidstudio. It only happens when I run
./gradlew :shared:build
from the terminal.
r
Do you definitely have the import for newSingleThreadContext? One thing that can happen when disabling the hmpp flags is, something fails to resolve in a shared source, and then the IDE autoformat clears the import. But if you have the import, even if the IDE doesn't resolve it, the code should compile.
a
@russhwolf yes the import is there for newSingleThreadContext
t
I’m not on 1.5.2 yet but in 1.5.1 it’s not a common method, only jvm/android and ios(-native-mt) specific
c
I don't think anything thread-related is Multiplatform (no threads in JS)
a
Our kmm library is just used in android and iOS.
Native-mt build of coroutines support multi threading on native/iOS. We have been using it in production to run our database requests on a separate single thread