Anyone has any idea why this crash `Caused by andr...
# android
a
Anyone has any idea why this crash
Caused by android.os.BadParcelableException: Parcelable protocol requires subclassing from Parcelable
is happening even my data class implement
Parcelable
interface and annotate with
@Parcelizee
, Any kind of hints/context would be appreciated
😶 1
z
If you can share a minimal sample project that produces this, I'd be happy to look at it. Perhaps your Gradle configuration isn't correct?
a
The problem is that it doesn't occur frequently and also can't reproduce it in local device(issue is from production). Checked all the possible reason but no clue why it crash sometimes.
e
Maybe, if it is happening in production, it is related to ProGuard/R8 rules? Your Parcelable may be obfuscated and not able to be accessed.
a
I think I don't need to set the rule explicitly since by default its already does this
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.txt")
or I need to do it explicitly for that module?
y
you should try to keep your class by adding this rule in your
proguard-rules
file by adding
-keep class com.package.of.yourdataclasses** { *; }
don't forget to update the package name by using your own.
214 Views