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
Right now I'm using launch blocks with Coroutines so when an UnhandledException occurs source, Android default handler can kick in and crash the app and log to Logcat. The latter is not happening.
After some research it happens that if I add android:sharedUserId="com.tsuharesu.shared" to my app Manifest.xml, Thread.getContextClassLoader() returns a dummy ClassLoader. Because of that, ServiceLoader fails to locate the resources and Thread.uncaughExceptionHandler is not called.
As a workaround, right now I'm doing this in my application:
open class TsuApplication : Application() {
override fun onCreate() {
// This makes it log again
Thread.currentThread().contextClassLoader = classLoader
super.onCreate()
}
}
Right now I'm using
launch
blocks with Coroutines so when an UnhandledException occurs source, Android default handler can kick in and crash the app and log to Logcat. The latter is not happening.After some research it happens that if I add
android:sharedUserId="com.tsuharesu.shared"
to my appManifest.xml
,Thread.getContextClassLoader()
returns a dummyClassLoader
. Because of that,ServiceLoader
fails to locate the resources andThread.uncaughExceptionHandler
is not called.It looks like changing here https://github.com/Kotlin/kotlinx.coroutines/blob/master/core/kotlinx-coroutines-core/src/CoroutineExceptionHandlerImpl.kt#L13 to also use
classLoader
would fix it.Sources:
https://stackoverflow.com/questions/13407006/android-class-loader-may-fail-for-processes-that-host-multiple-applications
ACRA/acra#656
ACRA/acra#657
The text was updated successfully, but these errors were encountered: