Do you really need to change the package name? Changing the package name is a pain that needs to be done automatically. That being said, here is my solution to the problem:
My scenario is that I have one application that is deployed in 30-200 different signed APK files, where the only difference between the files is some resources (drawings, lines, values, etc.) and the package name.
I do this while working on a generic version of an application that serves as a template project. When this is done, and I'm ready to deploy, I invoke a bash script that performs the following steps for each goal:
- Clear project completely
- Change the name and package name with sed.
- Creates and Signs APK
This balances the terrible time with the fast development time. I really don't see another more elegant / reliable solution than this.
And finally, a little tip: in the android manifest, use relative package names such as ".Application" instead of "com.mycompany.myproject.Application". Thus, you only need to change the package name in ONE place.
source share