Running this code on Android 9 device/emulator:
GlobalScope.launch {
throw IllegalStateException()
}
will result in a Accessing hidden method Ljava/lang/Thread;->getUncaughtExceptionPreHandler()Ljava/lang/Thread$UncaughtExceptionHandler; (light greylist, reflection) warning printed into Logcat.
Android 9 includes crackdown on developers using non-public stuff via reflection, and looks like coroutines got caught in this.
We are happy to use an official API, could you please point to the legal ways to handle an exception?
We can't just call Thread.defaultExceptionHandler (see #148), it does not log an exception but crash an application.
To be honest, I have no solution.
I think best bet is to Create ticket about this on Google's tracker and see what they think about it.
cc @adamp 鈽濓笍
The issue tracker link above is the right place to propagate this question for now. In the meantime iirc you should only see the warning once during the reflection lookup, subsequent invocations should be quiet. I can try to take a look in some more detail next week.
@qwwdfsad Thanks for the fix. Is this available in a release?