简体   繁体   中英

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

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM