rbz
rbz

Reputation: 769

Android Build Application with Ant

im pretty new at Ant and have been looking for alot of examples. I am pretty far now, and was successfull to get a build.xml going. Though i seem to have one thing missing. My application needs a custom Reference Library i am calling that is a jar file. But i dont know how to add it one. Any Tips, reference sites or examples you guys have, i would really appreciate it. Thank you

Upvotes: 3

Views: 1710

Answers (2)

CommonsWare
CommonsWare

Reputation: 1007584

Put the JAR file in the libs/ directory of your project. There is nothing else you need to do when building via Ant (Eclipse users also have to add the JAR to their build path). Here is a sample project showing the use of a BeanShell JAR.

Upvotes: 3

Dan Dyer
Dan Dyer

Reputation: 54515

To add the library you just need to make sure it is passed as an argument when invoking to the dx tool.

I use something very similar to the dex target in the template Ant build included with the SDK:

<!-- Convert this project's .class files into .dex files. -->
<target name="dex" depends="compile">
  <echo>Converting compiled files and external libraries into ${out-folder}/${dex-file}...</echo>
  <apply executable="${dx}" failonerror="true" parallel="true">
    <arg value="--dex" />
    <arg value="--output=${intermediate-dex-location}" />
    <arg path="${out-classes-location}" />
    <fileset dir="${external-libs-folder}" includes="*.jar"/>
  </apply>
</target>

The <fileset> element provides the library JARs to be included.

If you are using the standard Ant build, it should be sufficient to just put your JARs in the libs directory.

Upvotes: 3

Related Questions