Question

I have following Enum class in my Java package

public enum UIType {
    NATIVE,WEB;
}

I have applied following proguard config to keep this enum class

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

-keep public enum android.ui.UIType  {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

But when I offuscate my jar file,proguard keeps the UIType enum class but removes both NATIVE,WEB values.

In my obfuscated jar my Enum class looks as follows.

public enum UIType {

}

As seen above NATIVE,WEB values are removed by proguard :(.It is causing issue in my application since it is not finding those values.

Can somebody please guide me here what I am doing wrong.

Thanks

Was it helpful?

Solution

As I understand, you ask it to keep the methods values() and valueOf(), but not the values themselves.

Try

-keep public class com.ggg.xxx.Yyy { *; }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top