问题
How can I prevent method SendToGroup()
from Obfuscator in proguard.
Coz, this method name will be call from server side and need to be same name (dynamic method call). It's a push from signalR.
public class main {
private class inner implement x {
@Override
public Object dynamic {
return new Object {
@SuppressWarnings("unused")
public void SendToGroup(String message) {
androidNotification(message);
}
};
}
}
}
I have seen this and this but still not work and not understand.
Please advice.
回答1:
In order to keep an interface in progourd use the -keep public interface statement.
For example:
-keep public interface com.your_package_name.class_name$someInterface {*;}
In order to keep a class member in progourd use the - keepclassmembers statement.
For example:
-keepclassmembers class com.example.project.inner {
private static void someclass(java.lang.String);
}
回答2:
annotate the method with @Keep
来源:https://stackoverflow.com/questions/31607727/keep-method-name-from-obfuscator-proguard