Keep method name from Obfuscator Proguard

Question!

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.



Answers

annotate the method with @Keep

By : amo


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);
}


This video can help you solving your question :)
By: admin