When I am trying to use the sealedSubClasses
attribute of a reified class in Kotlin, it only works in my debug and not in my release build. I guess this is a problem with ProGuard, but I don't know how to fix this. I already tried keeping all classes in the module where the sealed class is, but I am having no luck with this. The sealedSubClasses
property always returns an empty list.
Found two ways to fix this issue:
-keep class com.example.ClassName { *; } -keep class com.example.ClassName$* { *; }
@Keep sealed class ClassName{ @Keep object A : ClassName() @Keep object B : ClassName() }
This one didn't work for me:
-keep class kotlin.Metadata { *; }
Also there is a bug https://issuetracker.google.com/issues/169264693 that could be the part of your problem.
You can try
-keep class kotlin.Metadata { *; }
to get missing attributes from your class
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With