title: Ant build script: cannot find android.jar
body: <p>Hallo,</p>
  
  <p>I cannot compile my project using an ant build script. The error message:</p>
  
  <pre><code>Ant cannot find symbol...
  </code></pre>
  
  <p>I read about creating <code>build.xml</code>, but it seems it is not enough. My project directory has the following layout:</p>
  
  <p>poject</p>
  
  <ul>
  <li>src   
  
  <ul>
  <li>gen  </li>
  <li>...</li>
  </ul></li>
  </ul>
  
  <p>libarie_with_needed_java.file</p>
  
  <ul>
  <li>src
  
  <ul>
  <li>clients</li>
  <li>helper</li>
  </ul></li>
  </ul>
  
  <p>How do I work with external references? Ant cannot find <code>android jar</code>. The <code>build.xml</code> file looks as follows:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  ==================================================================== --&gt;
  &lt;project name="test" default="main" basedir="."&gt;
  
  &lt;!-- ==================================================================== 
        Declare global properties for reuse and control of script
       ==================================================================== --&gt;
  
  &lt;!-- For project source files  --&gt;
  &lt;property name="src.dir" location = "src/de/test"/&gt; 
  &lt;property name="common.link" location = "../test-common/common"/&gt; 
  &lt;!-- For compiled/output files. --&gt;
  &lt;property name="build.dir" location = "build/source"/&gt;
  &lt;!-- For class libraries and dependency files. --&gt;
  &lt;property name="lib.dir" location = "lib"/&gt;
  &lt;property name="sdk.dir" location = "../android-sdk-windows/" /&gt;    
  
  &lt;!-- ==================================================================== 
        Einstiegspunnkt - Target main
       ==================================================================== --&gt;
  &lt;target name="main" depends="compile"  description="getting started"&gt;
    &lt;echo message="start main target"/&gt;   
  &lt;/target&gt;
  
  &lt;!-- ==================================================================== 
        Übersetzen - Target compile
       ==================================================================== --&gt;
  &lt;target name="compile" depends="init"&gt;
    &lt;echo message="start compile target"/&gt;
  
    &lt;javac srcdir="${src.dir}" destdir="${build}" debug="on"/&gt;
    &lt;classpath refid="classpath"/&gt; 
  &lt;/target&gt;
  
  &lt;!-- ==================================================================== 
        Initialisierungen - Target init
       ==================================================================== --&gt;
  &lt;target name="init" description="create needed directories"&gt;
    &lt;echo message="start init target"/&gt;
    &lt;mkdir dir="${build}"/&gt;
  &lt;/target&gt;   
  
  &lt;/project&gt;
  </code></pre>
  
  <p>I created this file using examples from websites and the file that Eclipse generated.</p>
  
  <p>I have removed the following external properties files (to simplify the problem):</p>
  
  <pre><code>&lt;property file="local.properties" /&gt;
  &lt;property file="build.properties" /&gt;
  &lt;property file="default.properties" /&gt;          
  </code></pre>
  
  <p>I need to include the external .java files from a different src location.</p>
  
  <p>I need to know how to copy the external files in the project and compile everything together.</p>
  
  <p>Thanks,
  Marcel</p>