ProGuard bytecode obfuscator

ProGuard is perhaps your best friend for high performance mobile Java. This is a tool that comes bundled into your Integrated Development Environment (IDE, Nokia IDE for Java ME (Eclipse) or NetBeans) and shrinks, optimises, and obfuscates your class files at build time. It removes unused classes, fields, and methods. It optimises bytecode to make your application smaller and run faster. It shortens your long class, method, and variable names to decrease the size of the JAR file. These measures will speed up application start time and reduce the amount of memory used per class file.

In NetBeans, obfuscator can be turned on in the following way:

Right click the project and select Properties > Build > Obfuscating.

See an example of the benefits of obfuscation in section Case example: Battle Tank.

Note that when ProGuard is turned ON, you may find it more difficult to debug your application, because the class and variable names are changed. Since ProGuard also takes some seconds to run each time the application is compiled, this can also slow you down when you are developing rapidly. Therefore, it is useful to leave ProGuard OFF until you are ready to deploy to a phone or nearing the optimisation stage at the end of your development cycle.