Skip to content

Added @Keep annotations for CoroutineExceptionHandler and MainDispatсherFactory which are loaded via ServiceLoader.load() on Android. #662

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

Closed
wants to merge 1 commit into from

Conversation

trashkalmar
Copy link

Android app crashes in runtime when obfuscated with default Proguard settings. This PR adds @Keep annotation for two classes which are located via ServiceLoader.load().

…herFactory which are loaded via ServiceLoader.load() on Android.
@fvasco
Copy link
Contributor

fvasco commented Oct 4, 2018

Does this PR work for Kotlin/JS?

@trashkalmar
Copy link
Author

Hm, it seems, @Keep is Android specific, so it will not help on other platforms.

@trashkalmar trashkalmar closed this Oct 4, 2018
@JakeWharton
Copy link
Contributor

You need to define an @OptionalExpecation expect annotation named Keep in the common code and then actual typealias it to the real annotation in the JDK code.

@fvasco
Copy link
Contributor

fvasco commented Oct 4, 2018

The PR is on the core module, so it is not possible to import the android.support.annotation.Keep annotation.

Moreover this PR does not include the imports.

@JakeWharton
Copy link
Contributor

Hence my comment which shows you how to do it correctly

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

Successfully merging this pull request may close these issues.

3 participants