At the company I'm working on, we pretty much use the approach Eugen proposed to automate the process of building applications, for example, you just need to brand differently by exchanging certain assets, styles, lines and configurations. We tend to customize the project and build the process as follows:
- Create an Android project and set it up so that it works for a specific branding. This will ensure that you can still create and run from Eclipse. Assuming the codebase does not change between versions released differently, this should be fine.
- Create an ant build configuration that:
- copies any files that will be changed to the backup directory
- modifies project files according to the configuration file (see below)
- compiles the sources of the project and signs it with the release key (when creating the assembly)
- copies files from step 1, overwrites any changes and returns the project to its original state.
- Create configuration files for each βbrandingβ or for language release in your scenario.
Basically, these steps will allow you to create branded / affiliate / language assemblies by simply providing the appropriate configuration with the ant build command. In our case, it looks something like this:
ant partner-release -Dpartner=stackoverflow
where "stackoverflow" will point to the configuration with the same name. In our case, these configuration files are small XML files containing all the parameters that must be replaced for a specific assembly. It may contain strings, but may also point to other files (for example, logo images) that should be copied to assets / resources. For instance:
<config> <version_name>1.00</version_name> <version_code>1</version_code> ... </config>
A few more pointers:
- We use
xmltask to modify any xml files in the project; e.g. manifest and resources. - Since the above task is really easy to use, our build configuration files are also configured as xml files as shown above. This is understandable to the user and easy and simple change.
- You can also use
replace and ReplaceRegExp tasks to change configuration-dependent variables in almost any file. The latter can be especially convenient for making changes to the build time in the source code.
source share