Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throwing exceptions inside coroutines generates warnings on Android 9 devices #822

Closed
matejdro opened this issue Nov 12, 2018 · 6 comments
Closed

Comments

@matejdro
Copy link

matejdro commented Nov 12, 2018

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.

@qwwdfsad
Copy link
Collaborator

qwwdfsad commented Nov 13, 2018

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.

@matejdro
Copy link
Author

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.

@LouisCAD
Copy link
Contributor

cc @adamp ☝️

@adamp
Copy link

adamp commented Nov 22, 2018

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
Copy link
Collaborator

qwwdfsad added a commit that referenced this issue Mar 7, 2019
…Pie runtime ensures that uncaught exception is always logged

Fixes #822
qwwdfsad added a commit that referenced this issue Mar 7, 2019
…Pie runtime ensures that uncaught exception is always logged

Fixes #822
@Ethan1983
Copy link

@qwwdfsad Thanks for the fix. Is this available in a release?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants