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

R8 has built-in support for ServiceLoader, Proguard rules need update #3111

vvb2060 opened this issue Dec 27, 2021 · 1 comment


Copy link

vvb2060 commented Dec 27, 2021

    private final ProguardPathFilter.Builder adaptResourceFilenames =
    private final ProguardPathFilter.Builder adaptResourceFileContents =

R8 use -adaptresourcefilenames and -adaptresourcefilecontents to handle META-INF/services/*, which I think is better than -keep or -keepnames:

The following rules can be removed:

-keep class {*;}
-keepnames class kotlinx.coroutines.internal.MainDispatcherFactory {}
-keepnames class kotlinx.coroutines.CoroutineExceptionHandler {}

internal class AndroidExceptionPreHandler :
AbstractCoroutineContextElement(CoroutineExceptionHandler), CoroutineExceptionHandler

Copy link

agrieve commented Apr 8, 2022

I was just looking at this as well, and it turns out that:
a) There is still a -keep rule in kotlinx-coroutines-android that should be removed, and
b) R8 natively supports META-INF/services / ServiceLoader.load since 1.5, so there's also no need for -adaptresourcefilecontents / -adaptresourcefilenames

pablobaxter pushed a commit to pablobaxter/kotlinx.coroutines that referenced this issue Sep 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

No branches or pull requests

2 participants