charlest
charlest

Reputation: 935

Android ant build: how to run android upload and not update build.xml, proguard.cfg

I am running the standard ant script build.xml which gets created when you run the android create project command. In order to verify my local.properties is set correctly, I added a task at the beginning of the build.xml script to run the command:

android update project -p .

I now get the following message each time I run the ant script, which clobbers my build.xml file and creates a proguard.cfg file!

File build.xml is too old and needs to be updated

So, I moved the ant script to a different file that won't get clobbered.

Is there a way to run the command android update project -p . that doesn't clobber build.xml and create proguard.cfg?

Upvotes: 3

Views: 2438

Answers (3)

The build.xml generated by android has the following comment:


     ****** 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"

so, it looks like Atham is right.

Upvotes: 0

Athan
Athan

Reputation: 11

Workaround for this. Add the following code in build.xml.

<!-- The following will prevent for 'android' tool to overwrite this file.

     (until sdk r12)
     classname="com.android.ant.SetupTask"

     (since sdk r13 FIXME)
     version-tag:custom
-->

With the piece of comment, 'android update project' will not complaint or overwrite the build.xml. As of now, there might be chance for changes in r13.

  • sdk r13 not yet released
  • it's based on aosp/master branch

updateProject() in package com.android.sdklib.internal.project.ProjectCreator determine to update the build.xml or not. (The code from sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectCreator.java)

Upvotes: 1

Doug Stevenson
Doug Stevenson

Reputation: 317740

I think this is a bug. I have registered a new bug with Google here:

http://code.google.com/p/android/issues/detail?id=17825

If anyone else thinks it's a bug, then please star it and perhaps contribute your thoughts.

Upvotes: 1

Related Questions