无法在 Kotlin 中导入协程
Unable to import coroutines in Kotlin
当我在其中一个 .kt 文件中使用以下内容时,
import kotlinx.coroutines.*
我收到编译错误 "Unresolved reference: coroutines"。
上下文:我正在 Android Studio 中使用 Kotlin 构建 Android 应用程序。
我可能做错了什么?
确保您在 build.gradle
文件中导入库:
dependencies {
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.2'
// Other dependencies here...
}
当我在其中一个 .kt 文件中使用以下内容时,
import kotlinx.coroutines.*
我收到编译错误 "Unresolved reference: coroutines"。
上下文:我正在 Android Studio 中使用 Kotlin 构建 Android 应用程序。
我可能做错了什么?
确保您在 build.gradle
文件中导入库:
dependencies {
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.2'
// Other dependencies here...
}