I am using proguard to obfuscate my android application. The android application contains some native code, which makes callbacks to fully qualified java methods. I need to not obfuscate these classes and the names of their methods. The below properly keeps the class names, but not the method names.
-keep public class com.me.dontobf.*
-keepnames public class com.me.dontobf.*
For native methods: ProGuard manual > Examples > Processing native methods
# note that <methods> means any method
-keepclasseswithmembernames,includedescriptorclasses class * {
native <methods>;
}
In this case, for callback methods: ProGuard manual > Examples > Processing callback methods
-keep class mypackage.MyCallbackClass {
void myCallbackMethod(java.lang.String);
}
Or e.g., if all public methods may be callback methods:
-keep class mypackage.MyCallbackClass {
public <methods>;
}
You probably also need to keep any program classes that occur in the method descriptors.