Thursday, January 5, 2012

Android with Proguard

Proguard shrinks, optimizes, and obfuscates your code by removing unused code and renaming classes, fields, and methods with semantically obscure names.

To use Proguard, you should use SDK 2.3.3 (API 10). If you wrote your project in API < 10, you should upgrade it:
android update project --name MyApp --target 2 --path ./MyAppProject

to get the target,run command:
android list targets
Then config your project to use Proguard:
http://developer.android.com/guide/developing/tools/proguard.html

For more android command:
http://developer.android.com/guide/developing/projects/projects-cmdline.html#UpdatingAProject

If you use Eclipse, choose File>Export to release your project in .apk file.
You should see proguard directory in your project directory after exported.

NOTE: you should keep mapping.txt file each time you release. It helps debug your app later.

No comments: