For The Decompilation, first read the http://blog.csdn.net/jltxgcy/article/details/17141127
Method 1: only use apktool
Apktool,xxx.apk is placed in the same directory
Decompilation:./apktool d-f xxx.apk, which generates the xxx folder
Re-package:./apktool B-f xxx (folder), generated xxx/dist, which contains the re-generated apk, but no signature
Cd xxx/dist
Re-Signature: jarsigner-verbose-keystore/home/jltxgcy/eclipse/jdk1.6.0/bin/android123.keystore-signedjar xxx_signed.apk xxx.apk android123.keystore
Align: zipalign-v 4 xxx_signed.apk xxx_align.apk
Method 2: Use the apktool, bakmail, and smail tools.
Baksmail and smail tools: https://code.google.com/p/smali/downloads/list
Apktool, smali-2.0.3.jar, baksmail-2.0.3.jar, and xxx.apk in the same directory
Decompilation:
(1)./apktool d-f-s xxx.apk. The xxx folder is generated, but the folder classes. dex is not parsed to smali.
Apktool command parameters details: Please see http://code.google.com/p/android-apktool/wiki/ApktoolOptions
(2) java-jar baksmali-2.0.3.jar-o baksmailout xxx/classes. dex
Repackaging:
(1) java-jar smali-2.0.3.jar baksmailout/-o xxx/classes. dex
(2)./apktool B-f xxx (folder)
The re-signature and alignment are similar to those above.