New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IllegalStateException: Module with the Main dispatcher is missing #799

Open
trashkalmar opened this Issue Nov 6, 2018 · 3 comments

Comments

Projects
None yet
4 participants
@trashkalmar

trashkalmar commented Nov 6, 2018

Our user with Xiaomi Redmi Note 4 device (Android 7.1.2) suddenly started to experience crash that had to be fixed with #657.
We're unable to reproduce it on our side. Here is reproducer app with the same lib dependencies as our main application: https://www.dropbox.com/s/eay696h9qmxjl5e/sample.zip?dl=1

AndroidX AppCompat: 1.0.0
Kotlin: 1.3.0
Coroutines: 1.0.0
Gradle wrapper: 4.10.2-bin

Caused by java.lang.IllegalStateException: Module with the Main dispatcher is missing. Add dependency providing the Main dispatcher, e.g. 'kotlinx-coroutines-android'
       at kotlinx.coroutines.MissingMainCoroutineDispatcher.missing(Dispatchers.kt:123)
       at kotlinx.coroutines.MissingMainCoroutineDispatcher.dispatch(Dispatchers.kt:116)
       at kotlinx.coroutines.DispatchedKt.resumeCancellable(Dispatched.kt:279)
       at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable(Cancellable.kt:23)
       at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:109)
       at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:160)
       at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:54)
       at kotlinx.coroutines.BuildersKt.launch(Unknown Source:1)
       at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch$default(Builders.common.kt:47)
       at kotlinx.coroutines.BuildersKt.launch$default(Unknown Source:1)
       at our.app.ui.base.BaseActivity.startAsync(BaseActivity.kt:229)
       at our.app.ui.main.MainActivity.refreshServerConfig(MainActivity.kt:63)
       at our.app.ui.main.MainActivity.onCreate(MainActivity.kt:134)
       at android.app.Activity.performCreate(Activity.java:6738)
       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2652)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2766)
       at android.app.ActivityThread.-wrap12(ActivityThread.java)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1507)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:154)
       at android.app.ActivityThread.main(ActivityThread.java:6236)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:891)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:781)

@qwwdfsad qwwdfsad self-assigned this Nov 6, 2018

@trashkalmar

This comment has been minimized.

trashkalmar commented Nov 6, 2018

UPD: We also use jetifier processor:

classpath "com.android.tools.build.jetifier:jetifier-processor:1.0.0-alpha10"

Newer version (1.0.0-beta02) is not compatible with databinding.

@Arayldan

This comment has been minimized.

Arayldan commented Nov 8, 2018

Uncomment the last two lines in your sample's proguard-rules.pro

@kimcy929

This comment has been minimized.

kimcy929 commented Nov 12, 2018

I enabled R8 and it is the problem. Only proguard no problem. coroutines version 1.0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment