Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert AndroidManifest.xml to Binary

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.

Android includes 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?

like image 587
jww Avatar asked Sep 12 '12 21:09

jww


2 Answers

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.

like image 135
Václav Hodek Avatar answered Oct 05 '22 10:10

Václav Hodek


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.)

like image 23
Kristopher Micinski Avatar answered Oct 05 '22 11:10

Kristopher Micinski