File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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
     
    Consider Paul's rocket mass heater.
     
    subject: Proguard: keep options behaving differently with Shrink and Obfuscate
     
    Similar Threads
    Problems aftrer shrinking my java application using proguard...
    Code Obfuscation?
    how to do obfuscation on web applicaion
    Obfuscating Package Names
    need of obfuscation code with web application and how to do it