-
Notifications
You must be signed in to change notification settings - Fork 1.9k
How can I make "R8's optimization of ServiceLoader" take effect? #4324
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
Comments
Hi! Would it be possible for you to provide a self-contained project where the issue reproduces, along with build instructions for it? There are many moving parts in Android build configurations, so it would greatly simplify the process of reproducing this if we had some code on our hands. |
Thank you, the "self-contained project" you mentioned inspired me. I put the all rules from
|
@whataa, I think it's reasonable that these two rules negate the effect of |
It's really hard to know why until figure out the two rules above. It's not a bug, I'll close it. |
This question is mainly about the initialization of android Dispatchers.Main, it has been discussed a long time ago, see #878 .
If I understand correctly, the final solution should be to rely on R8 to optimize ServiceLoader, see ServiceLoaderRewriter
But the problem I encountered is that after R8 processing, the bytecode of
MainDispatcherLoader
is still the corresponding source code, not the expected, I really don’t know what else I need to pay attention to, need help.expect:
actual:

I have confirmed that
optimization
is not turned off, no-dontoptimize
, and all rules inconfiguration.txt
containing thekotlinx
keyword come from the coroutines only.env:
The text was updated successfully, but these errors were encountered: