Has anyone experienced a missing MainDispatcher only manifesting in release builds distributed via google play?
👌 1
K 1
😶 1
j
Jose Mateo
05/25/2022, 4:21 PM
Oof good luck. I can't remember what we did to fix it, but I remember the pain.
l
lam bui
05/26/2022, 2:58 AM
i’ve never seen it before, can you be more specific? or there is evidence of error.
g
gildor
05/26/2022, 3:26 AM
Maybe some issue with R8? Or it works fine in release builds locally?
m
Michaeljon Hayden
05/26/2022, 3:41 PM
@lam bui Specifically
Copy code
Caused by java.lang.IllegalStateException
Module with the Main dispatcher is missing. Add dependency providing the Main dispatcher, e.g. 'kotlinx-coroutines-android' and ensure it has the same version as 'kotlinx-coroutines-core'
when we call
launchOnResumed
from an appcompat activity. The lifecycle lib tries to fetch the main dispatcher and fails.
Michaeljon Hayden
05/26/2022, 3:45 PM
@gildor R8 is our primary suspect but yes, as you stated, all of this works totally fine locally. The issue only occurs on release builds distributed via google play. WE are not the only ones who have misplaced a main dispatcher but everything that everyone has suggested has not made a difference.
g
gildor
05/27/2022, 1:48 AM
Have you tried to debug it by dumping classpath and see what is going on there
I would also suggest to just add a debug on your Application.onCreate which will try to resolve main dispatcher and maybe log classpath or maybe some additional information in case if Main dispatcher cannot be loaded
In general Main dispatcher is resolved dynamically on runtime, so if class is not there it fails