Open
Description
Describe the bug
If you use Proguard on JVM (e.g. as part of a Compose/Desktop application as per compose docs), then the MainDispatcherFactory is removed. When the application runs, it crashes because there is no main dispatcher.
The following Proguard rules are required:
-keep class kotlinx.coroutines.internal.MainDispatcherFactory { *; }
-keep class kotlinx.coroutines.swing.SwingDispatcherFactory { *; }
Proguard on Desktop/JVM doesn't have automatic rule consumption like Android, so documenting the requirement e.g. here https://github.com/Kotlin/kotlinx.coroutines#r8-and-proguard is critical.
Provide a Reproducer
This can be reproduced from this branch of our code:
https://github.com/UstadMobile/UstadMobile/tree/dev-desktop-conveyor
Remove the above lines from app-desktop/compose-desktop.pro , and the crash will be observed.
Alternatively:
- Create a new Compose JVM/Desktop app
- Enable obfuscation as per compose docs)
- Run it.