What is the right post build Ant target in android generated project file?

1.2k views Asked by At

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

1

There are 1 answers

2
NickT On

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