You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Incremental Android build drops the kotlinx-coroutines-android AAR, producing an APK that crashes on launch #23938
Incrementally rebuilding an Android head after the sources change produces an APK that is missing the kotlinx-coroutines-android AAR. The app then dies on launch, because androidx.window needs it to obtain the Main dispatcher:
E AndroidRuntime: FATAL EXCEPTION: main
E AndroidRuntime: java.lang.ExceptionInInitializerError
E AndroidRuntime: at kotlinx.coroutines.Dispatchers.getMain(Dispatchers.kt:20)
E AndroidRuntime: at androidx.window.layout.WindowInfoTrackerImpl.windowLayoutInfo(WindowInfoTrackerImpl.kt:66)
E AndroidRuntime: at androidx.window.java.layout.WindowInfoTrackerCallbackAdapter.addWindowLayoutInfoListener(...)
E AndroidRuntime: at crc64....ApplicationActivity.n_onStart(Native Method)
E AndroidRuntime: Caused by: java.lang.IllegalStateException: Module with the Main dispatcher is missing.
E AndroidRuntime: Add dependency providing the Main dispatcher, e.g. 'kotlinx-coroutines-android'
E AndroidRuntime: and ensure it has the same version as 'kotlinx-coroutines-core'
The build itself reports success — the failure only shows up at runtime, and only on onStart.
Expected behavior
An incremental rebuild produces a working APK, or fails the build.
How to reproduce it
Build SamplesApp.Skia.netcoremobile for net10.0-android in Release. Deploy — it works.
Change a source file in Uno.UI (or check out a different commit).
Rebuild the same project without clearing obj/bin. The build succeeds.
Deploy and launch — it crashes as above.
rm -rf src/SamplesApp/SamplesApp.Skia.netcoremobile/obj/Release bin/Release and rebuild. The APK works again.
Reproduced five times in a row today on net10.0-android, Release, SDK 10.0.300. A clean package has fixed it every time.
Notes
The failing call is ApplicationActivity.OnStart → WindowInfoTrackerCallbackAdapter.addWindowLayoutInfoListener, i.e. the foldable posture support, so it reproduces on every launch rather than only on a fold.
The symptom looks like application code failing, which makes it easy to misattribute — it cost several debugging cycles before the pattern (always fixed by a clean build, always returns on the next incremental one) made the cause obvious. Failing the build, or ensuring the AAR is re-merged on incremental builds, would both be preferable to a successful build that produces a broken APK.
Reproduced and traced: this is an upstream .NET for Android packaging bug, tracked at dotnet/android#11543. On an incremental repackage, the BuildArchive task silently drops all AAR java resources from the APK — including META-INF/services/kotlinx.coroutines.internal.MainDispatcherFactory, which is why Dispatchers.Main can't be resolved and the app crashes at startup while the build still reports success. It affects both Release dotnet publish and Debug -t:Install, on Windows and macOS.
Until the fix lands upstream, a cheaper workaround than a full clean is deleting the intermediate APK before packaging, in the Android head project:
Activity
ajpinedam commentedon Aug 3, 2026
Reproduced and traced: this is an upstream .NET for Android packaging bug, tracked at dotnet/android#11543. On an incremental repackage, the
BuildArchivetask silently drops all AAR java resources from the APK — includingMETA-INF/services/kotlinx.coroutines.internal.MainDispatcherFactory, which is whyDispatchers.Maincan't be resolved and the app crashes at startup while the build still reports success. It affects both Releasedotnet publishand Debug-t:Install, on Windows and macOS.Until the fix lands upstream, a cheaper workaround than a full clean is deleting the intermediate APK before packaging, in the Android head project: