[How To]: Decompile / Compile .APK
Brut.all of XDA has released the program APKtool which make the process of editing any APK file much easier, especially XML editing. Before you had to use a few different programs (Smali, hex editor, etc) to do the same thing. A future release is going to have the decompiler dump into an easy to import into Javabeans/Eclipse format.. so nice
Program and Usage link;
Before you start, download from the link above both the apktool-1.2.0.tar.bz2 and apktool-install-windows-2.2_r01-1.tar.bz2 and extract them to your windows folder.
apktool d <file.apk> <directory to output to>
*The compiled apk will be saved to the sub directory "dist", which is in what ever directory you choose to compile.
Smali directory - The output of classes.dex, the code to the apk
Res directory - Your resources, the images and layout/structure xmls
Lib directory - Shared library files
Dist directory - The apk output of the "apktool b" command, if you didn't run it you won't have it.
Build directory - The compiled output of the "apktool b" command, like what you would see if you just extracted an apk file with 7zip. If you didn't run it you won't have it.
Once you have your edited apk from the Dist directory you'll need to sign it. I use Dave Da illest 1 of XDA's modified script for signing. Just place your apk, this should be the only apk in this folder, in the same folder that you extracted the auto-signer to and execute sign.bat. The script will output your_app_signed.apk, which is your signed and ready to load on your phone apk.
If you'd like to decompile/compile an apk file that doesn't have a classes.dex, like framework-res.apk, just place any classes.dex into the apk and it will decompile. If you don't do this apktool will through up an error. Just remember to pull the classes.dex out before you sign it.
Editing an Apk file with APKTool;
Editing a Jar file with APKtool;
Localization / Translation
Adding in features or taking them out
Impressing friends and family, lol
I noticed that while the new version 1.2 works great on the framework-res.apk file, it seems to have issues with other System/app files like Settings.apk,Phone.apk, etc. For these files use version 1.1.1.
Hopefully this is helpful, I tend to ramble.
-Ften @ sdx-developers.com