2

I want to be able to obfuscate only a subset of classes with proguard, but am having a hard time since proguard seems to designed primarily to obfuscate everything, except for a blacklist.

However, the proguard manual does say:

For additional flexibility, class names can actually be comma-separated lists of class names, with optional ! negators, just like file name filters. This notation doesn't look very Java-like, so it should be used with moderation.

but there are no examples of that.

I am trying this:

-keep class !**.licence.** {*;}
-keep class !**.*Licence*.** {*;}

but that does work. If I remove the !, the patterns themselves do work (everything else gets obfuscated, except the above). I have also tried with the method definitiones ({*;} removed), but still does not work.

Does anyone have any examples of negators on classnames? Is there another way to tell proguard to only obfuscate specific class/package patterns (without using in-code annotations)?

Ben
  • 4,785
  • 3
  • 27
  • 39

1 Answers1

4

I finally figured it out on my own. The negations must all be on one line, like this:

-keep class !ca.nanometrics.**.licence.**,!ca.nanometrics.**.*Licence*{*;}
Ben
  • 4,785
  • 3
  • 27
  • 39