Jongz Puangput
Jongz Puangput

Reputation: 5637

Keep method name from Obfuscator Proguard

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.

Upvotes: 0

Views: 1829

Answers (2)

amo
amo

Reputation: 46

annotate the method with @Keep

Upvotes: 0

Avi Levin
Avi Levin

Reputation: 1868

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

Upvotes: 1

Related Questions