Encode/Decode AndroidManifest.xml inside APK

Soheil Setayeshi picture Soheil Setayeshi · May 27, 2013 · Viewed 43.2k times · Source

I'm using ApkTool to decode AndroidManifest.xml inside an APK file and it works perfectly but how can I encode it again ,the same way it was encoded before, after applying some changes? For example (in my case) changing the app label.

Answer

nif picture nif · Jun 17, 2013

You may use apktool again to create a new APK file including your changed AndroidManifest.xml.

First, decompile the APK file:

java -jar apktool.jar decode app.apk app

Then modify the files you want in the app directory and recompile it back into a new APK:

java -jar apktool.jar build app app_new.apk

aapt must be on our PATH or use the --aapt option to specify the location of the executable. Otherwise apktool will fail when rebuilding the APK.

Note: The rebuilt APK is neither signed nor zipaligned, just repackaged. Take a look at this website for details about signing and aligning your new APK.