1

I want to avoid obfuscating only a part of my code. Initially, I tried to use the -keep like this:

-keep class com.my.package.** { *; }

However, the only way I found to got this working as I needed was adding:

-dontobfuscate

Although, this way all the code is not obfuscated, and what I need is to not obfuscate only a specific part of my application (in this case a third party library com.my.package.**).

Does anyone know if it is possible?

Victor Laerte
  • 6,446
  • 13
  • 53
  • 102
  • Does this answer your question? [Proguard (R8) negate operator not working to keep anything except certain packages](https://stackoverflow.com/questions/59248681/proguard-r8-negate-operator-not-working-to-keep-anything-except-certain-packag) – emandt Jan 20 '22 at 11:18
  • Could you please explain why you don't think `-keep class com.my.package.** { *; }` is not doing what you are looking for. That should exactly cause all classes and members in `com.my.package` to _not_ be touched by the shrinker. – sgjesse Jan 20 '22 at 12:25

1 Answers1

1

To make sure ProGuard will not touch a specific part of your code, you can use a keeprule. The keep rule you mentioned should work. Can you maybe specify how you verified whether or not the names were still obfuscated?

The second thing you pointed out "using -dontobfuscate" will indeed keep everything which is most likely not the intended behaviour.

A good way to see the effects of certain keeprule on your source code is to use the ProGuard Playground. It's perfect for learning how ProGuard keep rules work and it allows you to upload your project once, after which you can interactively tweak your keep rules, without having to rebuild your app.

Edevont
  • 73
  • 6