About 1.3 coroutines


#1

In Kotlin 1.3,the “kotlinx.coroutines.experimental.async” prompts deprecated.What substitutes it?


#2

See



#3

Sorry.I use " import kotlinx.coroutines.async" to replace " import kotlinx.coroutines.experimental.async",but Android Studio prompts error.How should I do?


#4

You need to provide a coroutine-scope. Either you class needs to implement the interface CoroutineScope, or you need to have one from another call and use myCoroutineScope.async { ... }.

I believe this is different from the experimental coroutines.


#5

Is the “CoroutineScope” in Anko Coroutines?


#6

No, it is in the new coroutine libraries.

    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.0.1'
// for android you may also need this, there are also similar libraries for JavaFX and Swing.
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.0.1"