我正在尝试在Windows中构建本机。
我不确定将实现“ org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.5”的依赖项放在何处。
我当前的gradle文件如下:
buildscript {
ext.kotlin_version = '1.3.72'
repositories {
mavenCentral()
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
}
}
plugins {
id 'org.jetbrains.kotlin.multiplatform' version '1.3.72'
}
dependencies {
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.5'
}
repositories {
mavenCentral()
jcenter()
}
kotlin {
mingwX64("mingw") {
binaries {
executable {
// Change to specify fully qualified name of your application's entry point:
entryPoint = 'sample.main'
// Specify command-line arguments, if necessary:
runTask?.args('')
}
}
}
sourceSets {
mingwMain {
}
mingwTest {
}
}
experimental {
coroutines 'enable'
}
}
此依赖项行显示错误:
dependencies {
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.5'
}
错误是:
Could not find method implementation() for arguments [org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.5] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
如果删除该依赖关系,并且尝试导入kotlinx.coroutines。*和kotlin.concurrent.thread,则会得到“未解决的引用”
对此有所帮助。
谢谢
答案 0 :(得分:1)
org.jetbrains.kotlinx:kotlinx-coroutines-core-native
也 Kotlin / Native仅支持Gradle 4.10版,您需要在settings.gradle文件中启用Gradle元数据:
enableFeaturePreview('GRADLE_METADATA') 由于Kotlin / Native通常不提供版本之间的二进制兼容性,因此应使用与构建kotlinx.coroutines相同的Kotlin / Native编译器版本。
https://github.com/Kotlin/kotlinx.coroutines/blob/master/README.md