Unresolved reference: launch

前端 未结 4 536
孤独总比滥情好
孤独总比滥情好 2021-02-05 00:58

Trying to run some examples for Kotlin coroutines, but can\'t build my project. I\'m using the latest gradle release - 4.1

Any suggestions what to check/fix?

Her

4条回答
  •  渐次进展
    2021-02-05 01:31

    If you are using Coroutines 1.0+, the import is no longer

    import kotlinx.coroutines.experimental.*

    but

    import kotlinx.coroutines.launch

    You would need the following in the dependencies closure of your build.gradle (for Coroutines 1.0.1):

    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.0.1'
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.0.1"
    

提交回复
热议问题