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

spierce7

03/12/2020, 4:41 PM
I’m in 1.3.70, and even though I clearly have a dependency declared, I’m not able to resolve the coroutines lib when compiling. Has anyone seen this issue?
Copy code
Unresolved reference: coroutines
Unresolved reference: coroutines
Unresolved reference: CoroutineDispatcher
Unresolved reference: Dispatchers
Copy code
val iosMain by getting {
            dependencies {
                implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core-native:${Versions.kotlinxCoroutines}")

                implementation(Deps.ktor.client.ios)
                implementation(Deps.ktor.feature.serialization.native)
            }
        }
k

Kris Wong

03/12/2020, 5:17 PM
is it common code, and do you have the dependency for your common source set?
b

basher

03/12/2020, 5:21 PM
do you have
kotlin.mpp.enableGranularSourceSetsMetadata
enabled?
s

spierce7

03/12/2020, 6:33 PM
@Kris Wong The error is happening for the iosMain sourceSet:
Copy code
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.Dispatchers

internal actual object Platform {
    actual val dispatcher: CoroutineDispatcher
        get() = Dispatchers.Main
}
@basher I do have
Copy code
kotlin.mpp.enableGranularSourceSetsMetadata=true
set. I was just told to by someone the jetbrains team to work around an issue
b

basher

03/12/2020, 7:35 PM
Removing it should fix it. I think in 1.3.70 that flag also enables common metadata compilations that needs support from downstream libraries
k

Kris Wong

03/12/2020, 7:37 PM
fwiw,
kotlinx-coroutines-core-native
has gradle metadata
what happens if you move that dependency to
commonMain
instead of
iosMain
?
b

basher

03/12/2020, 8:03 PM
what's the name of the compile task?
6 Views