title: Building an android library project with jar dependencies
body: <p>I have been struggling with a problem for a few days now and I am at a loss for how to fix this. I am working with an Android Library project that is being compiled using the Android tool as provided by the android sdk. Inside the project, I follow the standard structure of an an android project (where my jar files are found inside the libs directory of the project:</p>
  
  <p><img src="https://i.stack.imgur.com/VMtMC.png" alt="enter image description here"></p>
  
  <p>I am finding that when I compile the project using Ant doing:</p>
  
  <pre><code>&lt;target name="compile-payment-lib" depends="prepare,init-profile"&gt;
      &lt;delete file="../payment-lib/project.properties"/&gt;
      &lt;exec executable="${android.tool}" dir="../payment-lib" failonerror="true"&gt;
          &lt;arg value="update"/&gt;
          &lt;arg value="lib-project"/&gt;
          &lt;arg value="-p"/&gt;
          &lt;arg value="${basedir}/../payment-lib"/&gt;
          &lt;arg value="-t"/&gt;
          &lt;arg value="${android.target.version}"/&gt;
      &lt;/exec&gt;
      &lt;echo file="../payment-lib/project.properties" message="android.library=true" append="true"/&gt;
      &lt;ant dir="../payment-lib" target="release"/&gt;
  &lt;/target&gt;
  </code></pre>
  
  <p>It is not including the jar files, and because of this it is losing references at runtime when we try to gather these classes and use them. I am compiling using the latest version of the android tools rev20.</p>
  
  <p>Some things that I've tried to resolve these references:</p>
  
  <ol>
  <li>Unjaring the Jar files and throwing the files into the bin directory and then adding those files to our master jar file</li>
  <li>Tried compiling the jars into the classes.dex (Don't know how to make use of this file at build time)</li>
  <li>Tried modifying the class path of the project to include the libs's jar files</li>
  </ol>
  
  <p>If anyone has any idea of what I could be doing wrong, please let me know.</p>
  
  <p>One thing I should mention is that this is a particular project is used with another project that is the actual application project. This project in particular is a library project with jar dependencies. </p>
  
  <p>Another thing is this is a Adobe Air application with some native extensions in android. So to complete our task, we have created an ANE with a master jar file that contains all our references using an ant task like this:</p>
  
  <pre><code>&lt;target name="master-jar" depends="prepare"&gt;
      &lt;delete dir="target/uber-jar" /&gt;
      &lt;mkdir dir="target/uber-jar"/&gt;
  
      &lt;antcall target="expand-3rdparty-jars" /&gt;
  
      &lt;jar destfile="${basedir}/target/master.jar"&gt;
          &lt;fileset dir="../game/gamelobby/bin/classes" includes="**/*"/&gt;
          &lt;fileset dir="../payment-lib/bin/classes" includes="**/*" excludes="**/R*.class" /&gt;
          &lt;fileset dir="../crosscell_ad_lib/bin/classes" includes="**/*" excludes="**/R*.class" /&gt;
          &lt;fileset dir="src" includes="config/**/*"/&gt;
          &lt;fileset dir="${basedir}/target/uber-jar" includes="**/*"/&gt;
      &lt;/jar&gt;
  &lt;/target&gt;
  </code></pre>