【发布时间】:2018-11-10 07:02:29
【问题描述】:
我正在尝试使用 kotlin.concurrency.thread 在 kotlin for android 中启动一个新线程但是我不断收到:
Unresolved reference: thread
我以为这是在标准库中?
实际代码:
fun identify(userId: Integer) {
thread() {
CustomExceptionHandler(context)
DoStuffClass.doStuff(context, userId)
}
}
【问题讨论】:
-
你为你的jdk版本添加了stdlib吗?看这里:kotlinlang.org/docs/reference/…
-
是的,我在我的依赖项中包含了 kotlin-stdlib-jdk8: implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
标签: multithreading concurrency kotlin standard-library