36

I want to obfuscate only some packages:

com.foo.*
com.bar.*

I have tried

-keepclasseswithmembers class **, !com.foo.**, !com.bar.** { *; }

and

-keepclasseswithmembers class !com.foo.** { *; }
-keepclasseswithmembers class !com.bar.** { *; }

In both cases the classes from com.foo.* and com.bar.* was NOT obfuscated.

Matthew Flaschen
  • 278,309
  • 50
  • 514
  • 539
alex2k8
  • 42,496
  • 57
  • 170
  • 221

1 Answers1

48

This should work

-keep class !com.foo.**,!com.bar.** { *; }

You can find a summary of the various -keep options at https://www.guardsquare.com/manual/configuration/usage#keepoptions

You can find the explanation of ProGuard's regular expressions at https://www.guardsquare.com/manual/configuration/usage#filters

Community
  • 1
  • 1
Eric Lafortune
  • 45,150
  • 8
  • 114
  • 106