Thursday, December 26, 2013

Progaurd in android / What is Proguard in Android / what is use of Proguard in Android

Proguard is mainly to avoid decompiling ( reverse engineering ) of .apk or .dex file.
Proguard is tool for shrinking , optimizing  and obfuscating the code by removing unused code and renaming classes , fields , methods with semantically obscure names.
Its integrated into the android build system.

You can add proguard.cfg file at root directory of the project. You can add rules how to optimize and obfuscates your code.

To enable ProGuard so that it runs as part of an Ant or Eclipse build, set the proguard.config property in the <project_root>/project.properties file.

You need to add cfg file in project.properties with its path.( As we added in root not need path . but if other location you need to add path)
proguard.config  =/path/to/proguard.cfg



ProGuard outputs files after it runs :
dump.txt
           describe internal structure of the class files in the .apk  file
mapping.txt
Its useful when receive bug report. Used to decode and gets stack .
Its mapping between the original and obfuscated class, method, and field names. 
seeds.txt
Lists the classes and members that are not obfuscated
usage.txt
Lists the code that was stripped from the .apk

Above all files are located at below path
  • <project_root>/bin/proguard if you are using Ant.
  • <project_root>/proguard if you are using Eclipse.


No comments:

Post a Comment