Android – way to generate ant file local.properties without overwriting build.xml

androidant

I've generated ant build.xml for my android project, using android update project --name <project_name> --target <target_ID> --path path/to/your/project/
(according to http://developer.android.com/guide/developing/other-ide.html) and then modified my build.xml (some custom code is there). So my build.xml is in the VCS.

But in order to perform a build I need local.properties file, which is also generated by android update project and so build.xml gets overwritten.

local.properties is not to be checked into the VCS.

Is there a way to only generate the local.properties so that developers (or a build server) can check out the code and build the project using build.xml from VCS?

Thanks!

Best Answer

Do not put local.properties into the VCS: generate it whenever it does not exist already (after a clean checkout, for instance), by running

android update project -p .

so android can generate it with the right path to the sdk. ant.properties or project.properties are meant to be put in VCS with whatever you need fixed on every possible build environment.

If you do not want the build.xml to be modified, change the version-tag entry to something different to its default value, which is 1. For instance:

<!-- version-tag: custom -->

If you have a look at the build.xml comments, it states that by saying:

 ***********************
 ****** IMPORTANT ******
 ***********************
     In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
     in order to avoid having your file be overridden by tools such as "android update project"