I'm struggling very much to get native dependencie...
# kotlin-native
d
I'm struggling very much to get native dependencies working for native targets in multiplatform projects. Specifically, I'd like to add
kotlinx-coroutines-core-native:1.0.1
as a dependency on a platform using the
mingwX64
preset. When specifying this dependency, gradle is not able to resolve it, despite the correct repositories being referenced. When specifying
common
variant of the dependency, gradle is able to resolve it, but no symbols are accessible in IntelliJ. All references remain unresolved. I made a new barebones multiplatform project, and I have the same problem. I also tried
kotlinx-serialization-runtime-native:0.9.0
and coroutines version 1.0.0 and I got the same results on both attempts. Setting
kotlin_native_version
in gradle.properties has no effect.
GRADLE_METADATA
feature is enabled. Repositories are present. What else could be going wrong?
build.gradle:
Copy code
plugins {
    id 'kotlin-multiplatform' version '1.3.10'
    // id 'org.jetbrains.kotlin.platform.native' version '1.3.10'
}

repositories {
    mavenCentral()
    maven { url '<http://kotlin.bintray.com/kotlin-dev>' }
    maven { url '<http://kotlin.bintray.com/kotlinx>' }
}

kotlin {
    targets {
        fromPreset(presets.mingwX64, 'mingw')
    }
    sourceSets {
        mingwMain {
            dependencies {
                implementation 'org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:0.9.0'
                //implementation 'org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:0.9.0'
                //implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core-common:1.0.1'
                implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core-native:1.0.0'
            }
        }
    }
}
o
d
Thanks for the pointer. Despite using kotlin 1.3.10 in my project, the behaviour I described persists. I noticed that some dependencies from the bundled kotlin dsl are inherited sometimes, that might have something to do with it.
Although, I doubt it
I think it has to do with the GRADLE_METADATA. I think there's a version discrepancy with respect to this feature. I'll update this thread when I figure it out.
I guess it's because kotlinx.coroutines/native readme mentions it requires exactly Gradle version 4.7
That might have been part of the problem. The thing that caused it in the end is the fact that release variants are missing from gradle metadata for kotlinx-coroutines-core-native versions 1.0.0-RC1 and later. That's what we think at least.
@olonho