viewModelScope as an extension function of the ViewModel


I try to do the CodeLabs example " Using Kotlin Coroutines in your Android App"
In step 5 they offer to use viewModelScope from the library androidx.lifecycle:lifecycle-viewmodel-ktx:x.x.x, but the Studio cannot resolve it.
That’s the matter and may be I have to add something else?


I don’t think there is any problem with Android Studio.
Have you referred this link?

Is there a lack at setting step ?

repositories {    
dependencies {    
   implementation "androidx.core:core-ktx:1.0.1"
   implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"


I have these dependencies.It doesn’t work


I think you’ll find something here