Android – how to keep enum from proguard

androidenumsproguard

In my proguard, I have the following to keep public enums from being obfuscated.

-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

My question is, does this also keep the public enum Currency in a class like this?

public class Foo {
    public enum **Currency** {PENNY, NICKLE, DIME, QUARTER};

    ...
}

If not, what do I have to add separately?

Adding the following doesn't seem to help.

-keepattributes InnerClasses

Any advice? Thanks

Best Answer

You could try

-keep public enum com.stuff.TheEnclosingClass$** {
    **[] $VALUES;
    public *;
}

As shown on this answer Proguard won't keep a class member's enums

Just don't forget to put

-keepattributes InnerClasses