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
In the obfuscation step, ProGuard renames classes and class members that are not entry points. In this entire process, keeping the entry points ensures that they can still be accessed by their original names. The preverification step is the only step that doesn't have to know the entry points.
ProGuard is a free shrinker, optimizer, obfuscator, and preverifier for Java bytecode: It detects and removes unused classes, fields, methods, and attributes. It optimizes bytecode and removes unused instructions. It renames the remaining classes, fields, and methods using short meaningless names.
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 { *; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With