How to use coroutines GlobalScope on the main thread?

后端 未结 2 2059
忘掉有多难
忘掉有多难 2021-02-03 12:15

I\'m trying to use the latest coroutines in 0.30.0, and having trouble figuring out how to use the new scoping. In the original coroutines I could set the context with UI or Co

2条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-03 12:49

    I was missing the Android portion of coroutines in my gradle file

    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:0.30.0"

    Once I had that, Dispatchers.Main appeared

提交回复
热议问题