I'm not sure why you chose to export an Ant file from Eclipse. If it was from an Android project, you're not going to get Ant target for the Android builders (because we didn't add any support for Ant export) so those steps are missing.
Interestingly your Ant file contains some bits from the Ant script we use (like the android.antlibs path item). In any case, I would recomend to ignore this file and create an Ant script using the 'android update project' command (http://developer.android.com/guide/developing/other-ide.html#CreatingAProject) Then read generated build.xml which provides clues about how to customize your own build script. I would also look at what we call "test projects" which do run instrumentation (http://developer.android.com/guide/developing/testing/testing_otheride.html). >From there the only missing piece you have is launching the emulator, as the install and run commands are present in the normal and test ant files we generate. This is trivial to do. Xav On Mon, Jul 19, 2010 at 1:52 AM, jrichards1...@googlemail.com <jrichards1...@googlemail.com> wrote: > Hi. > > i am trying to create a build.xml script that cleans, builds and > creates a apk file of a Junit android test project that i have > created. > > the steps i want to achieve in my build file is this: > > [list=]clean[/list] > [list=]build[/list] > [list=]create apk file[/list] > [list=]Sign apk file[/list] > [list=]launch emulator[/list] > [list=]install apk file[/list] > [list=]run instrumentalTest[/list] > [list=]Save the tests into an HTML Junit Report[/list] > > Anyone know how to achieve this? so far my build file looks like this: > > [code]<?xml version="1.0" encoding="UTF-8" standalone="no"?> > <!-- WARNING: Eclipse auto-generated file. > Any modifications will be overwritten. > To include a user specific buildfile here, simply > > create one in the same > directory with the processing instruction <? > > eclipse.ant.import?> > as the first entry and export the buildfile again. > > --> > <project basedir="." default="build" name="Unity Agent SDK Test"> > <property environment="env" /> > <property name="junit.output.dir" value="junit" /> > <property name="debuglevel" value="source,lines,vars" /> > <property name="target" value="1.6" /> > <property name="source" value="1.6" /> > <property file="build.properties" /> > <path id="android1.6.userclasspath"> > <pathelement location="lib/android.jar" /> > </path> > <path id="Junit.userclasspath"> > <pathelement location="lib/junit-4.8.2" /> > <pathelement location="lib/ > org.hamcrest.core_1.1.0.v20090501071000.jar" /> > </path> > <path id="Unity Agent SDK Test.classpath"> > <pathelement location="bin" /> > <pathelement location="lib/fb_connect-android-api.jar" /> > <pathelement location="lib/signpost-commonshttp4-1.2.jar" /> > <pathelement location="lib/signpost-core-1.2.jar" /> > <pathelement location="lib/UnityAgentSDK.jar" /> > <path refid="android1.6.userclasspath" /> > <path refid="Junit.userclasspath" /> > </path> > > <path id="android.antlibs"> > <pathelement path="${android-sdk-path}/tools/lib/anttasks.jar" > /> > <pathelement path="${android-sdk-path}/tools/lib/sdklib.jar" /> > <pathelement > path="${android-sdk-path}/tools/lib/androidprefs.jar" / >> > <pathelement > path="${android-sdk-path}/tools/lib/apkbuilder.jar" /> > <pathelement path="${android-sdk-path}/tools/lib/jarutils.jar" > /> > </path> > > <path id="run.Unity Agent SDK Test (1).classpath"> > <path refid="Unity Agent SDK Test.classpath" /> > </path> > <path id="run.Unity Agent SDK Test (1).bootclasspath" /> > <target name="init"> > <echo message="Initialize project" /> > <mkdir dir="bin" /> > <copy includeemptydirs="false" todir="bin"> > <fileset dir="src"> > <exclude name="**/*.launch" /> > <exclude name="**/*.java" /> > </fileset> > </copy> > <copy includeemptydirs="false" todir="bin"> > <fileset dir="gen"> > <exclude name="**/*.launch" /> > <exclude name="**/*.java" /> > </fileset> > </copy> > </target> > > <target name="clean"> > <echo message="Cleaning project" /> > <delete dir="bin" /> > </target> > <target depends="clean" name="cleanall" /> > <target depends="build-subprojects,build-project" name="build" /> > <target name="build-subprojects" /> > <target depends="init" name="build-project"> > <echo message="${ant.project.name}: ${ant.file}" /> > <javac debug="true" debuglevel="${debuglevel}" destdir="bin" > source="${source}" target="${target}"> > <src path="src" /> > <classpath refid="Unity Agent SDK Test.classpath" /> > </javac> > <javac debug="true" debuglevel="${debuglevel}" destdir="bin" > source="${source}" target="${target}"> > <src path="gen" /> > <classpath refid="Unity Agent SDK Test.classpath" /> > </javac> > </target> > <target description="Build all projects which reference this project. > Useful to propagate changes." name="build-refprojects" /> > <target description="copy Eclipse compiler jars to ant lib directory" > name="init-eclipse-compiler"> > <copy todir="${ant.library.dir}"> > <fileset dir="${ECLIPSE_HOME}/plugins" > includes="org.eclipse.jdt.core_*.jar" /> > </copy> > <unzip dest="${ant.library.dir}"> > <patternset includes="jdtCompilerAdapter.jar" /> > <fileset dir="${ECLIPSE_HOME}/plugins" > includes="org.eclipse.jdt.core_*.jar" /> > </unzip> > </target> > <target description="compile project with Eclipse compiler" > name="build-eclipse-compiler"> > <property name="build.compiler" > value="org.eclipse.jdt.core.JDTCompilerAdapter" /> > <antcall target="build" /> > </target> > <target name="Unity Agent SDK Test "> > <mkdir dir="${junit.output.dir}" /> > <echo message="making directory" /> > <junit fork="yes" printsummary="yes"> > <formatter type="xml" /> > <test name="com.kc.AllTests" > todir="${junit.output.dir}" /> > > <!-- > <test name="com.kc.AllTests" > todir="${junit.output.dir}" /> > > <test name="com.kc.unity.agent.util.ActivityOneTestcase" > todir="${junit.output.dir}" /> > <test > name="com.kc.unity.agent.util.FaceBookRestManagerTestCase" > todir="${junit.output.dir}" /> > <test > name="com.kc.unity.agent.util.OAuthManagerTestCase" todir="$ > {junit.output.dir}" /> > --> > > <classpath refid="Unity Agent SDK Test.classpath" /> > > <bootclasspath> > <path refid="run.Unity Agent SDK Test > (1).bootclasspath" /> > </bootclasspath> > </junit> > <echo message="junit finished" /> > </target> > <target name="junitreport"> > <junitreport todir="${junit.output.dir}"> > <fileset dir="${junit.output.dir}"> > <include name="TEST-*.xml" /> > </fileset> > <report format="frames" todir="${junit.output.dir}" /> > </junitreport> > </target> > > <!-- > Build it and set it up for android > --> > <echo message="Build it and set it up for android" /> > <echo message="${android-sdk-path}" /> > <target name="push_tests_to_device" depends="build"> > <exec executable="${android-sdk-path}/tools/adb.exe"> > <arg value="install"/> > <arg value="${test_apk_path}"/> > </exec> > </target> > > <target name="run_tests" depends="push_tests_to_device"> > <exec executable="${android-sdk-path}/tools/adb.exe"> > <arg value="shell"/> > <arg value="am"/> > <arg value="instrument"/> > <arg value="-w"/> > <arg > value="com.kc.tests/android.test.InstrumentationTestRunner"/> > </exec> > </target> > > </project> > [/code] > > i can clean and build the project fine but dont know how to create the > apk file, sign it, run the instrumentalTest and produce junit reports > in html. > > thanks in advance. this is the first time i have dived into this. i > tried auto generating the build.xml using eclipse > project > export >>ant build script and it doesnt add the apk building, running the > instrumenatlTest and running the emulator stuff in it. > > -- > You received this message because you are subscribed to the Google > Groups "Android Beginners" group. > > NEW! Try asking and tagging your question on Stack Overflow at > http://stackoverflow.com/questions/tagged/android > > To unsubscribe from this group, send email to > android-beginners+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/android-beginners?hl=en > -- Xavier Ducrohet Android SDK Tech Lead Google Inc. Please do not send me questions directly. Thanks! -- You received this message because you are subscribed to the Google Groups "Android Beginners" group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en