I have an AndroidManifest.xml, and I need to convert it to binary and place it by hand in the APK. After that, I can do a manual sign and align.
Longer explanation: I’m having trouble [again] with the familiar tools used in APK re-engineering, and I’m bulding the APK by hand with tools that don’t crash.
sdklib.jar, but I’m having trouble calling it (and it might not perform ‘just’ the XML -> binary conversion).
How does one convert
AndroidManifest.xml to binary?
You can try to run aapt manually like this:
$LIBS"aapt" package -f -m -F output_unsigned.apk --auto-add-overlay -S main/res -J Temp/gen -G Temp/android-aapt.pro -A Temp/assets -M Temp/AndroidManifest.xml -I $LIBS"android.jar"
In my case (under linux):
- $LIBS”aapt” is a path to aapt file
- output_unsigned.apk is where to save created APK
- android-aapt.pro is where to save configuration for proguard
- Temp/gen, Temp/assets are my Android project folders
- Temp/AndroidManifest.xml is desired manifest
- $LIBS”android.jar” is JAR library for requested Android API level
It may not work for you out-of-the-box, but I hope it helps you to start with it. Consult aapt help for more details.
If you have not seen it yet, there is android-apktool, which is quite helpful for these kinds of things. I have successfully used them before in repacking APKs by hand after modifying their binaries.
You can also look for the
apkbuilder tool which is in my
android-sdk-linux/tools/ directory. (It is, however, deprecated.)