AndroidでParcelable、Serializable、Enumのクラスを使う時は@Keepも共に使おう
AndroidアプリではProGuardへの対応はまあ必須である。
圧縮プロセスの過程で、Parcelable、Serializable、Enum のクラス名が難読化されないようにする必要がある。その対応方法
- @Keepアノテーションを使用する
@Keep class ParcelableArg : Parcelable { ... } @Keep class SerializableArg : Serializable { ... } @Keep enum class EnumArg { ... }
- もしくはproguard-rules.proに追記する
-keepnames class com.path.to.your.ParcelableArg -keepnames class com.path.to.your.SerializableArg -keepnames class com.path.to.your.EnumArg
どちらかをやっておけばよい。
説明がnavigationのところにあるのがモヤモヤ感