I don't know how to get intellij to let me use `Gl...
# kotlin-native
j
I don't know how to get intellij to let me use
GlobalScope.launch
Copy code
kotlin {
    targets {
        // For ARM, preset should be changed to presets.iosArm32 or presets.iosArm64
        // For Linux, preset should be changed to e.g. presets.linuxX64
        // For MacOS, preset should be changed to e.g. presets.macosX64
        fromPreset(presets.linuxX64, 'linux')

        configure([linux]) {
            compilations.main.outputKinds('DYNAMIC')
        }
    }
    sourceSets {
        // Note: To enable common source sets please comment out 'kotlin.import.noCommonSourceSets' property
        // in gradle.properties file and re-import your project in IDE.
        commonMain {
            dependencies {
                api('org.jetbrains.kotlinx:kotlinx-coroutines-core-native:1.0.0')
            }
        }
        linuxMain {

        }
        linuxTest {
        }
    }
}
g
Isn’t commonMain should have only common dependencies? So maybe you need this instead?
api('org.jetbrains.kotlinx:kotlinx-coroutines-core-common:1.0.0')
I’m not familiar with new MPP plugin, just a guess
s
Also please ensure that you have
enableFeaturePreview('GRADLE_METADATA')
in
settings.gradle
.
y
We are also encountering the same issue and we have this line in our
settings.gradle
This is a snippet of our `build.gradle`:
Copy code
commonMain {
            dependencies {
                implementation 'org.jetbrains.kotlin:kotlin-stdlib-common'
                api('org.jetbrains.kotlinx:kotlinx-coroutines-core-common:1.0.0')
            }
        }
And we can successfully use this in
iosMain
using
coroutines-core-native:1.0.0