Chapter 16 P 316: [Coroutines] launch(CommonPool) Unresolved Reference

The book states:
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:0.19.3
then
launch(CommonPool) {
mapsViewModel.addBookmarkFromPlace(placeInfo.place,
placeInfo.image)
}

This produces an Unresolved Ref error.

The solution seems to be the following, but grateful for confirmation:

build.gradle (Module: app)
implementation “org.jetbrains.kotlinx:kotlinx-coroutines-core:1.0.1”
implementation “org.jetbrains.kotlinx:kotlinx-coroutines-android:1.0.1”

MapsActivity.kt
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch

then
GlobalScope.launch() {
mapsViewModel.addBookmarkFromPlace(placeInfo.place, placeInfo.image)
}

@tblank Can you please help with this when you get a chance? Thank you - much appreciated! :]

Hi @mazen_kilani,

The coroutines library has been updated since the book was written, and I can confirm that using GlobalScope.launch is the new alternative to launch(CommonPool). This will be reflected in the next edition of the book.

Thank you reading the book and letting us know about the changes you are finding!

-Tom