这个问题是这个线程的延续: https ://github.com/Kotlin/kotlinx.coroutines/issues/246#issuecomment-407023156
我正在尝试org.jetbrains.kotlinx:kotlinx-coroutines-core-native:0.23.4-native-1
在针对 iOS 的 Kotlin/Native 项目中使用。
build.gradle
:
buildscript {
repositories {
mavenCentral()
maven { url "https://dl.bintray.com/jetbrains/kotlin-native-dependencies" }
}
dependencies {
classpath 'org.jetbrains.kotlin:kotlin-native-gradle-plugin:0.8'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.51"
}
}
apply plugin: 'kotlin-platform-native'
repositories {
jcenter()
mavenCentral()
maven { url "https://kotlin.bintray.com/kotlinx" }
}
sourceSets {
main {
component {
target 'ios_arm32', 'ios_arm64', 'ios_x64'
outputKinds = [KLIBRARY]
}
}
}
dependencies {
expectedBy project(':common')
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-native:0.23.4-native-1"
}
该kotlinx:kotlinx-coroutines-core-native
依赖项似乎不起作用,因为会产生如下构建错误:
error: unresolved reference: coroutines
import kotlinx.coroutines.experimental.*
^
如果我手动包含工件依赖项,例如org.jetbrains.kotlinx:kotlinx-coroutines-core-native_release_ios_x64:0.10.3-native
,那么我会得到一个编译器异常:
exception: java.lang.IllegalStateException: Could not find "atomicfu-native"
即使我还添加了org.jetbrains.kotlinx:atomicfu-native:0.10.3-native
依赖项,此错误仍然存在。