androidpackageapkandroid-manifestrecompile

How to compile AndroidManifest.xml programmatically on Android?


I want to know how to implement a apk editor which can edit app name and version.

A way I can figure out takes several steps:

  1. unzip apk file

  2. modify app name and version in AndroidManifest.xml

  3. replace the AndroidManifest.xml with the modified one

  4. compress them into a new apk file

  5. sign and align it

I can do all the steps above except Step 2. The AndroidManifest.xml file is compiled and cannot be parsed as normal xml file. I know apktool can compile and decompile it but I cannot find a easy way to run apktool on Android after several hours searching. I also cannot find any open-source apk editors(what I need is not only a apk editor, I want to develop another app based on it).


Solution

  • Finally I find some projects for reading and writing AXML(Android XML) and resources.arsc:

    So I can wirte an apk builder with them. For more information, see my repo Auto.js-ApkBuilder.