Main dispatcher missing on version 1.2.1 (android gradle plugin 3.5.0-beta02)
See original GitHub issueWhen upgrading our project to coroutines version 1.2.1 (from 1.2.0), we get a
java.lang.IllegalStateException: Module with the Main dispatcher is missing. Add dependency providing the Main dispatcher, e.g. 'kotlinx-coroutines-android'
Here are the relevant parts of our build.gradle:
root:
ext.coroutines_version = '1.2.1'
one of many library modules in our project module: (all looking basically the same, there is no import of another version somewhere)
dependencies {
/* Test */
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
/* Kotlin */
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
/* Coroutines */
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
Gradle version: 5.4.1 Android gradle plugin: 3.5.0-beta02
The same configuration works using the older agp version 3.4.0 or the older coroutines version 1.2.0
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:9 (6 by maintainers)
Top Results From Across the Web
Module with Main dispatcher is missing - Stack Overflow
Using just the kotlinx-coroutines-android version solves the problem.
Read more >runtime NPE in Kotlin Coroutine Dispatcher - Issue Tracker
... Plugin for Android. classpath 'com.android.tools.build:gradle:3.5.0-alpha03' ... IllegalStateException: Module with the Main dispatcher is missing.
Read more >Dispatchers.Main - Kotlin
A coroutine dispatcher that is confined to the Main thread operating with UI objects. Usually such dispatchers are single-threaded.
Read more >Diff - jdk8-b08^1..jdk8-b08 - toolchain/jdk/jdk9_jdk
debuginfo support by setting ALT_OBJCOPY to a non-existent path + OBJCOPY=$(shell test -x $(ALT_OBJCOPY) && echo $(ALT_OBJCOPY)) + endif +endif + +ifdef ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I just reported it myself to bring awareness early to the Android Gradle plugin team: https://issuetracker.google.com/issues/133495912 @sellmair if you have additional details that could help them, please, share them into that linked issue.
May I ask to report the bug to AGP then?