문제

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

도움이 되었습니까?

해결책

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 { *; }
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top