What is ProGuard?

27 Aug

ProGuard is a free Java class file shrinker, optimizer, obfuscator, and preverifier. It detects and removes unused classes, fields, methods, and attributes. It optimizes bytecode and removes unused instructions. It renames the remaining classes, fields, and methods using short meaningless names.

Some uses of ProGuard are:

  • Creating more compact code, for smaller code archives, faster transfer across networks, faster loading, and smaller memory footprints.
  • Making programs and libraries harder to reverse-engineer.
  • Listing dead code, so it can be removed from the source code.
  • Retargeting and preverifying existing class files for Java 6 or higher, to take full advantage of their faster class loading.

ProGuard‘s main advantage compared to other Java obfuscators is probably its compact template-based configuration. A few intuitive command line options or a simple configuration file are usually sufficient.

Console screenshot

Usage

To run ProGuard, just type:

java -jar proguard.jar options

You can find the ProGuard jar in the lib directory of the ProGuard distribution. Alternatively, the bin directory contains some short Linux and Windows scripts containing this command. Typically, you’ll put most options in a configuration file (say, myconfig.pro), and just call:

java -jar proguard.jar @myconfig.pro

You can combine command line options and options from configuration files. For instance:

java -jar proguard.jar @myconfig.pro -verbose

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: