Build.xml 参考如下:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project basedir="." default="build" name="sdk2.0.0">
<taskdef resource="jockytasks">
</taskdef>
<property file="build.properties" />
<property name="output.dir" value="${out.dir}" />
<property name="target" value="1.7" />
<path id="project.classpath">
<pathelement location="${project.bin.classes}" />
<pathelement location="${android.jar}"></pathelement>
<pathelement location="${extend1.jar}"></pathelement>
<pathelement location="${extend2.jar}"></pathelement>
<pathelement location="${extend3.jar}"></pathelement>
<pathelement location="${extend4.jar}"></pathelement>
<pathelement location="${extend5.jar}"></pathelement>
<pathelement location="${extend6.jar}"></pathelement>
<pathelement location="${extend7.jar}"></pathelement>
<pathelement location="${extend8.jar}"></pathelement>
<pathelement location="${extend9.jar}"></pathelement>
<pathelement location="${extend10.jar}"></pathelement>
</path>
<target name="init" depends="clean">
<mkdir dir="${output.dir}" />
<mkdir dir="${output.dir}/bin/classes" />
</target>
<target name="clean">
<delete dir="${output.dir}/bin/classes" />
<delete dir="${output.dir}" />
</target>
<target depends="init" name="compile">
<echo message="${ant.project.name}: ${ant.file}" />
<javac destdir="${output.dir}/bin/classes" target="${target}"
includeantruntime="no" encoding="utf-8" fork="yes">
<src path="src" />
<classpath refid="project.classpath" />
</javac>
</target>
<target name="build" depends="compile" >
<echo> Proguad .... </echo>
<jar basedir="${output.dir}/bin/classes" destfile="temp.jar" />
<java failοnerrοr="true" fork="true" jar="E:\Yangzc\android\android_sdk\tools\proguard\lib\proguard.jar">
<arg value="-injars temp.jar" />
<arg value="-outjars optimized.jar" />
<arg value="-libraryjars ${android.jar}" />
<arg value="@proguard-project.txt" />
</java>
<delete file="temp.jar" />
<delete dir="${output.dir}/bin/classes" />
<mkdir dir="${output.dir}/bin/classes" />
<unzip dest="${output.dir}/bin/classes" src="optimized.jar" />
</target>
</project>
Python:脚本参考如下;
if __name__ == '__main__':
cmd3 = 'ant -f + ''build.xml build'
os.system(cmd3)
Build.property 主要是一些必要jar的路径。