I am using apache ant 1.8 for compilation. I need help on creating build.xml.
1) Is there is any tool in eclipse to do so. 2) Also, i am importing a jar file in project. How can i specify the jar file in build .xml file. Thanks in advance Veradis On Tue, Apr 27, 2010 at 1:29 AM, Xavier Ducrohet <x...@android.com> wrote: > It looks like your using a 3rd party Ant build system instead of the > one that comes with the SDK. > > From the stack trace of the exception it looks like this is > http://code.google.com/p/autoandroid/wiki/AndroidAnt > You might want to file a bug there, or ask a question to the commiter > of that project. > > Xav > > On Sat, Apr 24, 2010 at 12:57 AM, veradis <veradism...@gmail.com> wrote: > > Hi, > > > > I want to compile my Android APP using ANT in windows. I placed > > build.xml in project root and included necessary jars in project lib > > folder. I had made proper configurations for ant also, but its not > > working. Please help me on this. > > > > Error > > ==== > > > > C:\Documents and Settings\nav\workspace\YumFlixMobile>ant > > Buildfile: C:\Documents and Settings\nav\workspace\YumFlixMobile > > \build.xml > > > > clean: > > > > resource-src: > > > > BUILD FAILED > > C:\Documents and Settings\nav\workspace\YumFlixMobile\build.xml:33: > > java.lang.Nu > > llPointerException > > at > > com.googlecode.androidant.AndroidTools.locateTool(AndroidTools.java:8 > > 1) > > at > > com.googlecode.androidant.AndroidTools.startTool(AndroidTools.java:74 > > ) > > at > > com.googlecode.androidant.AndroidTools.startTool(AndroidTools.java:62 > > ) > > at > > com.googlecode.androidant.WindowsAndroidTools.aapt(WindowsAndroidTool > > s.java:36) > > at aapt.main(aapt.java:7) > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > > at > > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. > > java:39) > > at > > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces > > sorImpl.java:25) > > at java.lang.reflect.Method.invoke(Method.java:597) > > at > > org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.java:217) > > at > > org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:15 > > 2) > > at org.apache.tools.ant.taskdefs.Java.run(Java.java:771) > > at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java: > > 221) > > at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java: > > 135) > > at org.apache.tools.ant.taskdefs.Java.execute(Java.java:108) > > at > > org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) > > at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) > > at > > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces > > sorImpl.java:25) > > at java.lang.reflect.Method.invoke(Method.java:597) > > at > > org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav > > a:106) > > at org.apache.tools.ant.Task.perform(Task.java:348) > > at > > org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68) > > at > > org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > > at > > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. > > java:39) > > at > > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces > > sorImpl.java:25) > > at java.lang.reflect.Method.invoke(Method.java:597) > > at > > org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav > > a:106) > > at org.apache.tools.ant.Task.perform(Task.java:348) > > at > > org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.jav > > a:398) > > at > > org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > > at > > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. > > java:39) > > at > > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces > > sorImpl.java:25) > > at java.lang.reflect.Method.invoke(Method.java:597) > > at > > org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav > > a:106) > > at org.apache.tools.ant.Task.perform(Task.java:348) > > at org.apache.tools.ant.Target.execute(Target.java:390) > > at org.apache.tools.ant.Target.performTasks(Target.java:411) > > at > > org.apache.tools.ant.Project.executeSortedTargets(Project.java:1360) > > at org.apache.tools.ant.Project.executeTarget(Project.java: > > 1329) > > at > > org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExe > > cutor.java:41) > > at org.apache.tools.ant.Project.executeTargets(Project.java: > > 1212) > > at org.apache.tools.ant.Main.runBuild(Main.java:801) > > at org.apache.tools.ant.Main.startAnt(Main.java:218) > > at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280) > > at org.apache.tools.ant.launch.Launcher.main(Launcher.java: > > 109) > > > > Total time: 1 second > > > > ===================================================================== > > > > build.xml > > ======= > > > > <?xml version="1.0" encoding="utf-8"?> > > <project name="YumFlixMobile" default="precommit" > > xmlns:android="antlib:com.googlecode.androidant"> > > > > <!-- Requires ant 1.7 or better --> > > > > <property environment="env"/> > > <condition property="android-home" value="$ > > {env.ANDROID_HOME}"> > > <isset property="env.ANDROID_HOME"/> > > </condition> > > > > <property name="android-ant.jar" location="lib/android- > > ant.jar"/> > > <taskdef uri="antlib:com.googlecode.androidant" > > resource="com/googlecode/androidant/antlib.xml" > > classpath="${android-ant.jar}"/> > > > > <!-- Dependencies --> > > > > <fileset dir="lib" id="main.jars"> > > <include name="positron.jar"/> > > </fileset> > > > > <fileset dir="lib" id="test.jars"> > > <include name="positron.jar"/> > > <include name="junit.jar"/> > > </fileset> > > > > <!-- Rules --> > > > > <target name="clean" description="Delete the output > > directories."> > > <delete dir="target"/> > > </target> > > > > <target name="resource-src" description="Generate the R.java > > file for this project's resources."> > > <android:aapt> > > <arg value="package"/> > > <arg value="-m"/> > > <arg value="-J"/> > > <arg file="src"/> <!-- Create R.java in the > > source directory --> > > <arg value="-M"/> > > <arg file="AndroidManifest.xml"/> > > <arg value="-S"/> > > <arg file="res"/> > > <arg value="-I"/> > > <arg file="${android-home}/android.jar"/> > > </android:aapt> > > </target> > > > > <target name="compile-main" depends="resource-src" > > description="Compile the java source."> > > <mkdir dir="target/main-classes"/> > > <javac encoding="ascii" target="1.5" debug="true" > > extdirs="" > > srcdir="." > > destdir="target/main-classes" > > bootclasspath="${android-home}/ > > android.jar"> > > <classpath> > > <fileset refid="main.jars"/> > > </classpath> > > </javac> > > </target> > > > > <target name="dex" depends="compile-main" description="Convert > > the .class files into .dex files."> > > <property name="classes.dex" location="target/ > > classes.dex"/> > > <android:dx inputref="main.jars"> > > <arg value="--dex"/> > > <arg value="--output=${classes.dex}"/> > > <arg path="target/main-classes"/> > > </android:dx> > > </target> > > > > <target name="package-res" description="Put the project's > > resources into the output package file."> > > <android:aapt> > > <arg value="package"/> > > <arg value="-f"/> > > <arg value="-M"/> > > <arg file="AndroidManifest.xml"/> > > <arg value="-S"/> > > <arg file="res"/> > > <!-- No assets directory --> > > <arg value="-I"/> > > <arg file="${android-home}/android.jar"/> > > <arg value="-F"/> > > <arg file="target/notepad.ap_"/> > > </android:aapt> > > </target> > > > > <target name="package-apk" depends="dex, package-res" > > description="Package the application and sign it with a debug key."> > > <android:apk-builder> > > <arg file="target/notepad.apk"/> > > <arg value="-z"/> > > <arg file="target/notepad.ap_"/> > > <arg value="-f"/> > > <arg file="target/classes.dex"/> > > <arg value="-rf"/> > > <arg file="src"/> > > <arg value="-rj"/> > > <arg file="lib"/> > > </android:apk-builder> > > </target> > > > > <target name="start-emulator" description="Start an > > emulator."> > > <android:adb><arg value="start-server"/></android:adb> > > <android:start-emulator name="emulator"> > > <arg line="-skin 320x480 -no-boot-anim"/> > > </android:start-emulator> > > </target> > > > > <target name="stop-emulator" description="Stop the emulator we > > started."> > > <android:stop-emulator name="${emulator}"/> > > </target> > > > > <target name="install" depends="package-apk, start-emulator" > > description="Install the package on the default emulator."> > > <android:adb> > > <arg value="-s"/> > > <arg value="${emulator}"/> > > <arg value="install"/> > > <arg value="-r"/> > > <arg file="target/notepad.apk"/> > > </android:adb> > > </target> > > > > <target name="demo" depends="install" description="Run the > > application until Return is hit."> > > <input>Have fun with the demo, press Return when > > you're done.</input> > > </target> > > > > <target name="compile-stories" depends="compile-main" > > description="Compile the stories."> > > <mkdir dir="target/story-classes"/> > > <javac target="1.5" debug="true" srcdir="stories" > > destdir="target/story-classes"> > > <classpath> > > <pathelement location="target/main- > > classes"/> > > <fileset refid="test.jars"/> > > <pathelement location="${android-home}/ > > android.jar"/> > > </classpath> > > </javac> > > </target> > > > > <target name="run-stories" depends="compile-stories, install"> > > <mkdir dir="target/junit-reports"/> > > <junit haltonfailure="true" fork="true" > > forkMode="once" printsummary="true"> > > <sysproperty > > key="positron.instrumentedPackage" value="com.example.android.notepad"/ > >> > > <sysproperty key="positron.apk" file="target/ > > notepad.apk"/> > > > > <formatter type="plain"/> > > <batchtest todir="target/junit-reports"> > > <fileset dir="target/story-classes"/> > > </batchtest> > > <classpath> > > <pathelement location="target/main- > > classes"/> > > <fileset refid="test.jars"/> > > <pathelement location="${android-home}/ > > android.jar"/> > > </classpath> > > </junit> > > </target> > > > > <target name="precommit" depends="clean, run-stories, stop- > > emulator" description="If this passes you are safe to commit."/> > > > > </project> > > > > ===================================================================== > > > > > > Thanks > > Veradis > > > > -- > > You received this message because you are subscribed to the Google > > Groups "Android Developers" group. > > To post to this group, send email to android-developers@googlegroups.com > > To unsubscribe from this group, send email to > > android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com> > > For more options, visit this group at > > http://groups.google.com/group/android-developers?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 Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en