无法在 Kotlin 中导入协程

Muk*_*iya 2 kotlin kotlin-coroutines

当我在其中一个 .kt 文件中使用以下内容时,

import kotlinx.coroutines.*
Run Code Online (Sandbox Code Playgroud)

我收到编译错误,提示“未解析的引用:协程”。

上下文:我正在 Android Studio 中使用 Kotlin 构建 Android 应用程序。

我可能做错了什么?

Tod*_*odd 5

确保您正在build.gradle文件中导入库:

dependencies {
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.2'
    // Other dependencies here...
}
Run Code Online (Sandbox Code Playgroud)