Keep inner interface method names in proguard

VicVu picture VicVu · Sep 4, 2014 · Viewed 14.8k times · Source

Lets say I have..

public class SomeClass {


    public interface someInterface {

        public void firstMethod(String variable);


        public void secondMethod(String variable);


        public void thirdMethod();

    }
}

and I do..

-keep,includedescriptorclasses public class com.somepackage.SomeClass {
    <fields>;
    <methods>;
}

-keep public interface com.somepackage.someInterface {*;}

I end up with

public interface someInterface {

        public void a(String variable);


        public void a(String variable);


        public void a();

    }

How do I ensure this interface's method names are not obfuscated while still obfuscating the rest of the class?

Answer

Eric Lafortune picture Eric Lafortune · Sep 7, 2014

ProGuard uses the naming convention of Java bytecode, as seen in class file names and stacktraces. Therefore:

-keep public interface com.somepackage.SomeClass$someInterface {*;}