I trying to keep all classes and methods names, but obfuscated all the fields in my project.
For example, this code:
public class MyClass {
private int myInt;
public String myString;
void myMethod() {
// Method code;
}
}
Should turn into this code
public class MyClass {
private int a1;
public String a2;
void myMethod() {
// Obfuscated method code;
}
}
Note that the class name and method name doesn't get obfuscated, but the field name does.
I'm guessing it is some sort of combination with keepnames and keepclassmembernames, but I'm not sure what is the correct one.
Try below if you can add access modifier to the method you want to keep , e.g you want to keep all public methods.
-keep class MyClass
-keepclassmembers class MyClass {
public <methods>;
}
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