Unable to import coroutines in Kotlin

Viewed 1591

When I am using following in one of the .kt files,

import kotlinx.coroutines.*

I am getting compilation error saying "Unresolved reference: coroutines".

Context: I am building Android App using Kotlin in Android Studio.

What could I be doing wrong?

1 Answers

Make sure you are importing the library in your build.gradle file:

dependencies {
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.2'
    // Other dependencies here...
}
Related