After adding the library jetbrains.kotlinx.coroutines.core.jvm
, the IDE seems to show coroutine-related classes in the auto-complete (first image below). However, building the source code below
import kotlinx.coroutines.*
fun main(args: Array<String>) {
}
fails with "Main.kt: (1, 8): Unresolved reference: kotlinx". Why is this so? I added the library in Project Settings -> Modules -> untilted3 (project name) and main (at first I added it to main, then I also added it untiled3) -> Dependencies, as the second image below.
CodePudding user response:
Generally, as long as I know, this problem is due to a plugin that needs to be added to Gradle Project's file apply plugin: 'kotlin-android-extensions'