Source example:
// this is package visible interface
interface MyInterface {
void foo();
}
public class MyClass1 implements MyInterface {
// some public class members which should not be obfuscated
// ...
// this is MyInterface implementation, this method should be obfuscated:
void foo() {}
}
// other classes which implement MyInterface
...
How do I keep all public members in MyClass1 and in other classes while only obfuscating MyInterface.foo() implementations.
ProGuard doesn’t provide any shortcuts to specify all methods but one. You’ll have to specify the ones you need. Presumably, there is a reason why you have to keep them. For instance, if they implement another interface, you can easily specify to keep all the methods of this other interface.
Note that -keep specifications refer to the names of the classes/fields/methods, not to the code of the methods:
ProGuard manual > Usage > Overview of -keep options