书籍国家:
实现“org.jetbrains.kotlinx:kotlinx-coroutines-core:0.19.3
然后
发射(commonpool){
mapsviewmodel.addbookmarkFromplace(placeInfo.place,
placeinfo.image)
}

这会产生未解决的ref错误。

解决方案似乎是以下的,但感激确认:

build.gradle(模块:应用程序)
实现“org.jetbrains.kotlinx:kotlinx-coroutines-core:1.0.1”
实现“org.jetbrains.kotlinx:kotlinx-coroutines-android:1.0.1”

mapsactivity.kt.
导入kotlinx.coroutines.globalscope.
导入kotlinx.Coroutines.Launch.

然后
globalscope.launch(){
mapsviewModel.addbookmarkMromplace(PlaceInfo.place,PlaceInfo.Image)
}

@tblank. 当你有机会时,你能帮忙吗?谢谢 - 非常感谢! :]

你好 @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.

谢谢阅读这本书并让我们了解您所在的更改!

-tom.