【发布时间】:2020-05-02 14:13:36
【问题描述】:
我正在尝试在 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,我会得到“未解析的引用”
感谢您对此的帮助。
谢谢
【问题讨论】: