For debugging reasons, I need to install more instances of my app. I found that the app identifier is located in binary AndroidManifest.xml in APK file so I don't have to mess with the app identifier at the project level that has unwanted consequences.
Note that there are similar questions on stackoverflow but none of them can answer this, as far as I know.
The rename should be as easy as running the following command: (where apk_dir
is the directory where the original APK was extracted to)
aapt package -v --rename-manifest-package com.xyz.abc apk_dir
However, it merely enumerates all the resources in the apk
directory. Nothing changes, no error message is printed. This is quite confusing - when I instruct a tool to make changes that it can't make, it should let me know clearly it was not done.
There are few 3rd party tools that I don't want to use because the official appt
tool should be able to change the package name (and because the other tools have issues). It seems to be a powerfull tool but it is underdocumented. However, the help it prints seems promising:
--rename-manifest-package
Rewrite the manifest so that its package name is the package name
given here. Relative class names (for example .Foo) will be
changed to absolute names with the old package so that the code
does not need to change.
It is also very unfortunate that there are two formats of AndroidManifest.xml. Besides the expected one there is the binary (compiled) manifest XML file that is packed into the APK file. This doesn't make reading documentation easier.