0

I am using Android 2.3 generated build.xml to compile my Android app. I am trying to integrate the ant build with master build process. The master build process likes to copy all the generated apks to a specific folder.

I see that Android build.xml has debug and release targets as well as -pre-build, -post-compile targets.

Is there any target that I can add to my build.xml that gets invoked after .apk file is generated?

There I can add my post build target.

Thanks
Video guy

videoguy
  • 1,732
  • 2
  • 24
  • 49

1 Answers1

1

I think 'release' is the last target that can run. You could just add a copy command in the release target to copy the apks to your folder. I've moved to SDK 4.0 which has a different build.xml structure, but when I was using the old one, I had a section in my build.xml's release target

<!-- Zip aligns the APK -->
    <zipalign-helper in.package="${out.unaligned.file}" out.package="${newout.release.file}" />
    <echo>Release Package: ${newout.release.file}</echo>

    <echo message="Copying the googlemapdebug.xml back to googlemap.xml" />
    <echo message="ALWAYS LEFT IN DEBUG FROR ECLIPSE" />
    <copy file="${layout.dir}/googlemapdebug.xml" tofile="${layout.dir}/googlemap.xml" overwrite="true" />

which copied a single file back after a release build (I'd defined layout_dir in my build.properties and before the compile I'd previously copied a googlemaprelease.xml which had my GoogleMap release API key in it).

You could adapt this and have your apk copied to a folder specified in your build properties

NickT
  • 23,844
  • 11
  • 78
  • 121
  • Are you creating a new target where you are copying these files or overriding builtin target (i.e. release)? If you override, how do you invoke the target defined in android tools/ant/build.xml file? – videoguy Nov 21 '11 at 16:44
  • I overrode the release target in my copy of the build.xml. Other targets that I've not altered are still available, as it takes them from the file you referred to in tools.. That file is imported into my copy in the normal way. If you look down the bottom of the standard build.xml it tells you To customize existing targets, there are two options: - Customize only one target: - copy/paste the target into this file, *before* the task. - customize it to your needs. – NickT Nov 21 '11 at 17:08