java.lang.IllegalStateException: Module with the Main dispatcher is missing. Add dependency providing the Main dispatcher, e.g. 'kotlinx-coroutines-android'
at kotlinx.coroutines.internal.MissingMainCoroutineDispatcher.missing(MainDispatchers.kt:73)
at kotlinx.coroutines.internal.MissingMainCoroutineDispatcher.isDispatchNeeded(MainDispatchers.kt:54)
at kotlinx.coroutines.DispatchedKt.resumeCancellable(Dispatched.kt:373)
at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable(Cancellable.kt:25)
at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:109)
at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:160)
at kotlinx.coroutines.channels.ActorKt.actor(Actor.kt:121)
at kotlinx.coroutines.channels.ActorKt.actor$default(Actor.kt:112)....
提示Module with the Main dispatcher is missing该错误,问题可以复现,希望工程师可以解决一下该问题。kotlin版本 1.3.20,协程版本1.1.1
按文档集成了Sophix,在不使用kotlin协程的情况,加载补丁后都是可以正常运行,实现热修复。 问题在于,使用了kotlin的协程之后,则会出现如下日志:
java.lang.IllegalStateException: Module with the Main dispatcher is missing. Add dependency providing the Main dispatcher, e.g. 'kotlinx-coroutines-android' at kotlinx.coroutines.internal.MissingMainCoroutineDispatcher.missing(MainDispatchers.kt:73) at kotlinx.coroutines.internal.MissingMainCoroutineDispatcher.isDispatchNeeded(MainDispatchers.kt:54) at kotlinx.coroutines.DispatchedKt.resumeCancellable(Dispatched.kt:373) at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable(Cancellable.kt:25) at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:109) at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:160) at kotlinx.coroutines.channels.ActorKt.actor(Actor.kt:121) at kotlinx.coroutines.channels.ActorKt.actor$default(Actor.kt:112)....
提示Module with the Main dispatcher is missing该错误,问题可以复现,希望工程师可以解决一下该问题。kotlin版本 1.3.20,协程版本1.1.1