Reputation: 7051
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?
Upvotes: 29
Views: 20072
Reputation: 199
For those who are looking for how to keep a custom annotation (which is defined in a @interface in java) retaining its all members,
you should actually use like below to keep it:
-keep @interface com.your.annotation.interface. {*;}
Upvotes: 1
Reputation: 5659
I tried the following and it seemed to work:
-keep interface com.somepackage.SomeClass$someInterface
Upvotes: 2
Reputation: 45648
ProGuard uses the naming convention of Java bytecode, as seen in class file names and stacktraces. Therefore:
-keep public interface com.somepackage.SomeClass$someInterface {*;}
Upvotes: 45