Using ProGuard to keep an entry point in a library, and also not allow it to be obfuscated, I use the proguard keep rule:
-keep,includedescriptorclasses public class com.demo.api.** { *; }
I would like to replace this rule with a @Keep annotation like this:
@Keep
public class SomeClass {
public void someMethod() { /*..*/ }
}
If I analyze the aar library containing this class, the SomeClass was kept (not shrunk) and not obfuscated along with method someMethod, as expected.
If I build an app using this library, however, the class SomeClass is kept, but its members are still obfuscated. The app only has the default rules
and an empty local proguard_rules.txt:
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
How can I get the @Keep annotation behave in a similar way as the ProGuard -keep rule?