aspose file tools*
The moose likes Other Open Source Projects and the fly likes Proguard: keep options behaving differently with Shrink and Obfuscate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Proguard: keep options behaving differently with Shrink and Obfuscate" Watch "Proguard: keep options behaving differently with Shrink and Obfuscate" New topic
Author

Proguard: keep options behaving differently with Shrink and Obfuscate

Prince Manchanda
Ranch Hand

Joined: Jun 25, 2001
Posts: 52
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.


    Thanks and Regards
    P Manchanda
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Proguard: keep options behaving differently with Shrink and Obfuscate