Convert AndroidManifest.xml to binary

I have AndroidManifest.xml and I need to convert it to a binary file and put it manually in the APK. After that, I can make a manual sign and align.

Longer explanation: I am having problems with the new tools used in the reengineering of the APK, and I collect the APKs manually with tools that don't crash.

Android includes sdklib.jar , but I am unable to call it (and it may not perform "just" XML-> binary conversion).

How to convert AndroidManifest.xml to binary?

+6
source share
2 answers

You can try to execute the aapt command manually as follows:

 $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 the path to the aapt file
  • output_unsigned.apk - where to save the created APK
  • android-aapt.pro - this is where to save the configuration for proguard
  • Temp / gen, Temp / assets are my folders with projects for Android.
  • Temp / AndroidManifest.xml - desired manifest
  • $ LIBS "android.jar" is the JAR library for the requested Android API level.

This may not work for you out of the box, but I hope this helps you get started with it. See the help system for more information.

+3
source

If you have not seen this before, there is android-apktool , which is very useful for such things. I have successfully used them before, repackaging the APK manually after modifying their binaries.

You can also find the apkbuilder tool, which is located in my android-sdk-linux/tools/ directory. (However, it is deprecated.)

+2
source

Source: https://habr.com/ru/post/925255/


All Articles