question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Android app with coroutines 0.30.1-eap13 crashes in runtime

See original GitHub issue
java.lang.IllegalStateException: Module with Main dispatcher is missing. Add dependency with required Main dispatcher, e.g. 'kotlinx-coroutines-android'
        at kotlinx.coroutines.Dispatchers.getMain(Dispatchers.kt:61)

kotlinx-coroutines-android is obviously added. Version 0.30.0-eap13 works fine.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:8
  • Comments:22 (4 by maintainers)

github_iconTop GitHub Comments

6reactions
trashkalmarcommented, Oct 4, 2018

If an app is obfustacted with default proguard settings, it crashes in runtime. Here is sample project to reproduce an issue: https://www.dropbox.com/s/eay696h9qmxjl5e/sample.zip?dl=1 UPD: I’ve created PR #662 but it will not work, because @Keep annotation is Android specific. Is the only way to add proguard rules?

-keepnames class kotlinx.coroutines.CoroutineExceptionHandler {}
-keepnames class kotlinx.coroutines.internal.MainDispatcherFactory {}
5reactions
jvladcommented, Oct 15, 2018

The same issue with 0.30.1 in release build only (i. e. when minifyEnabled true is specified)

Android Studio 3.1.2 Build #AI-173.4720617, built on April 14, 2018 JRE: 1.8.0_152-release-1024-b01 x86_64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Mac OS X 10.13.4

Didn’t work:

-keepnames class kotlinx.coroutines.CoroutineExceptionHandler {}
-keepnames class kotlinx.coroutines.internal.MainDispatcherFactory {}

Worked:

-keepnames class kotlinx.** { *; }
Read more comments on GitHub >

github_iconTop Results From Across the Web

Kotlin android app crashes because of coroutines
1, my app is crashing when I open 2 different activities where such a communication is happening. Here's the error I'm getting: E/AndroidRuntime...
Read more >
Crashes - Android Developers
An Android app crashes whenever there's an unexpected exit caused by an unhandled exception or signal. An app that is written using Java...
Read more >
Sporadic native crash on Android when debugging coroutines
Sometimes(about 80% of the time) when I'm hitting breakpoint in a depply nested coroutine call, my app crashes inside _native_ code.
Read more >
runtime NPE in Kotlin Coroutine Dispatcher - Issue Tracker
makes the app to crash as soon as it is launched because of missing Kotlin Coroutine Dispatcher -> This is what the crash...
Read more >
Coroutines in Android explained - Zaid Zakir - Medium
What is coroutines? · If your app has some requirement to block the main thread while performing a task in suspend function. ·...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found