0

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.

Community
  • 1
  • 1
Jongz Puangput
  • 5,527
  • 10
  • 58
  • 96

2 Answers2

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);
}
Avi Levin
  • 1,868
  • 23
  • 32
  • For the annotations use: -keepattributes *Annotation* For the interface use: -keep class com."Package name"."Interface name" { public *; } The public * - is to allow all public methods using proguard. or: -keep public interface com.your_package_name.class_name$someInterface {*;} to allow it on the class itself. – Avi Levin Jul 24 '15 at 13:53
0

annotate the method with @Keep

amo
  • 56
  • 3