I have methods that are used by Android framework ObjectAnimator
instances. Hence they appear to be unused (they are used through reflection) and I add SuppressWarnings("unused")
annotation, so IntelliJ don't show warnings for them. However, ProGuard still strips them and I need to explicitly tell him not to. This is tedious and seems redundant (violates DRY). Is it possible to configure ProGuard not to remove methods with SuppressWarnings("unused")
?
Options that tell ProGuard to keep some classes and members (fields and methods) are described in the official documentation: http://proguard.sourceforge.net/manual/usage.html#keepoptions.
You can tell ProGuard to preserve class members using:
-keepclassmembers class_specification
Your class_specification
will look like:
class * {
@java.lang.SuppressWarnings <methods>;
}
So, in your proguard.cfg
you should have something like this:
-keepclassmembers class * {
@java.lang.SuppressWarnings <methods>;
}