Ant if else condition?

The if attribute does not exist for <copy>. It should be applied to the <target>. Below is an example of how you can use the depends attribute of a target and the if and unless attributes to control execution of dependent targets. Only one of the two should execute. <target name=”prepare-copy” description=”copy file based on … Read more

How do I set -Dfile.encoding within ant’s build.xml?

If you’ve got files encoded in a particular way, it’s probably best to tell javac that rather than forcing the whole JVM to use a particular encoding. The javac task has an encoding attribute for this reason. <javac srcdir=”${src.dir}” destdir=”${build.classes.dir}” encoding=”iso-8859-1″ /> But really, you should just convert the source files to UTF-8. Everything tastes … Read more

Multiple Android Application Package .apk files from single source code

I’m generating 2 different APK’s (demo and production) from one single source tree with 3 small modifications: 1) I have public static final DEMO=true; //false; in my Application class and depending on that value I used to switch code between demo/production features 2) There are 2 main activities, like: package mypackage; public class MyProduction extends … Read more