Saturday, December 3, 2011

Android ProGuard and Git Tip

If you're obfuscating your Android applications using ProGuard, make sure to keep the proguard/ directory at the root of your Android project under revision control. This may seem contrary to what you'd feel like doing, as the files are autogenerated, but it will help if you ever need to debug a stack trace from your published application.

Typically when I'm ready to release, and after I've done every other change, I will bump the revision in my AndroidManifest.xml and generate a new .apk from eclipse, then test it out on my device. If everything looks good, I'll commit the manifest change, along with the now updated proguard directory, with a commit message containing the release number. Then I'll tag that commit with the same name. This way, if that release ever has any exceptions I need to debug, I can download the obfuscated stack trace from the Android developer console, run git checkout <TAGNAME>, and use the proguard files from that release to deobfuscate the strack trace.

Keeping the proguard files under git makes them quickly and easily accessible, should you ever require them.

No comments:

Post a Comment

© 2012 James Bowes. Icons by glyphicons. Powered by Blogger.