-
Notifications
You must be signed in to change notification settings - Fork 618
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
Serialization with proguard #2385
Comments
Rules provided with the library should be sufficient for most of the cases.
Can you show an example of such a class? There's also a separate section in readme for classes which have named companions (https://github.com/Kotlin/kotlinx.serialization#android) (under spoiler), maybe this is your case? |
👋 We've encountered the same issue and I've been able to create a reproducer for it: https://github.com/SimonMarquis/kotlinx.serialization-2385 In our case, the issue comes from the fact the |
@shanshin Will you be able to take a look? |
@SimonMarquis What would be wanted is that the serializer is not removed ( |
@SimonMarquis, the error occurs in Related issue square/retrofit#3588. We cannot specify As a solution, we may add an indication to the documentation that when using external tools that use reflection, special rules should be added. Or ask to add this rule to the artifact Working rule: |
The problem will be solved when implementing this in Retrofit. |
Describe the bug
I got the following exception when trying to serialize some classes after using proguard:
The data class had the
@Serializable
annotation but it still got obfuscated. Interestingly, the issue happens for some classes, and for some, it doesn't. Even though they are in the same package.Expected behavior
Class is not obfuscated.
When I added the following rule to proguard this issue was fixed:
-keep @kotlinx.serialization.Serializable class *
Environment
I tried different version of IDE, and r8 but the crash always happened
The text was updated successfully, but these errors were encountered: