androidproguardparcelableandroid-proguard

Do I need to 'keep' Parcelable in proguard rules while obfuscating


My Project has few classes that extends Parcelable. Do I need to 'keep' them in proguard rules while obfuscating.

What is the general practice for parcelables?


Solution

  • No, the default android rules include this:

    -keepclassmembers class * implements android.os.Parcelable {
      public static final android.os.Parcelable$Creator CREATOR;
    }
    

    These default rules will be applied if you leave the default generated gradle definition in place:

    proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'