Problem with kotlin parcelize and proguard rules

Viewed 600

I have this class:

@Parcelize
data class UserData(val name: String = "", val country: String = ""):Parcelable

In the proguard rules i have:

-keep class com.example.app.model.UserData

Then i use this in the repo (from Firebase):

val userdata = firestoreDoc.toObject(UserData::class.java)

If i disable minifyEnabled it works fine and userData gets populated, but when i enable it, it returns an empty UserData object.

I noticed that if i add the @Keep annotation to the UserData class it works as expected but i don't understand why.

Doesn't the proguard rules already keep the class? Do i need to add a rule for kotlin parcelize?

0 Answers
Related