This week's book giveaway is in the Reactive Progamming forum.
We're giving away four copies of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams and have Adam Davis on-line!
See this thread for details.
Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Proguard: keep options behaving differently with Shrink and Obfuscate

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am exploring the use of Proguard for my web application. I am primarily interested in shrinking and obfuscating my Applets. What I observed was that the -keep options behave differently with SHRINK and OBFUSCATE options.

For Example, my config file contains the following options to enable shrink and obfuscate and disable optimize and preverify:




The only keep option that



None of the classes in my input jar extend the Driver class

On running this I get the following exception:



After that I change my config file to remove the # that is uncomment the -dontshrink option. This means that I am instructing Proguard to only obfuscate my input jar. In this case everything works fine and I am able to get an obfuscated JAR. The package names and class names have been changed in the obfuscated JAR. All the classes from input JAR were present in the obfuscated JAR.

In an attempt to understand the problem with SHRINK, I

  • Removed the comment from -dontobfuscate, so as not to obfuscate
  • Commented the above keep option and the and added the following keep condition:




  • In this case I am only Shrinking the code. On running this I was able to get an output JAR with only one class that was mentioned in the above keep option.

    This makes me to believe that
  • in case of SHRINK, Proguard shrinks only those classes that match the keep conditions
  • in case of OBFUSCATE, Proguard obfuscates those classes that don't match the keep conditions


  • Is this a known behavior or I am missing something.

    If this is a known behavior, then how do we make Proguard to SHRINK and OBFUSCATE same set of classes with a single configuration.
     
    What does a metric clock look like? I bet it is nothing like this tiny ad:
    Java file APIs (DOC, XLS, PDF, and many more)
    https://products.aspose.com/total/java
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!