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.