Help me to keep enum values

Hello developers,
I’m working on an extension project and here I’m using some enum classes. But the ProGuard is shirking the enum values even I’m using keep rules for that class.

-keep class com.buxi.csvparser.common.Model {
  public protected *;
}

It’s com.buxi.csvparser.common.Model a enum class and I want to keep this class with its values. Please help me to do it.
Thanks in advance :+1:

-keepclassmembers enum com.buxi.csvparser.common.Model {
    <fields>;
}

This will retain all enum constant

make sure that any other proguard rule does not coflict with this
or any library you are using have coflicting proguard rules

Try these rules below. I believe it should keep all values ​​from the model enum class.

-keepclassmembers enum com.buxi.csvparser.common.Model {
  public static [] values();
  public static  valueOf(java.lang.String);
}
1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.