title: Target "${build.target}" does not exist in the project "LibA" when running Android's build.xml from Gradle
body: <p>I have an Android project which depends on three android libraries. It's project.properties file looks like the following:</p>
  
  <pre><code>split.density=false
  android.library.reference.2=..\\LibB
  proguard.config=proguard.cfg
  android.library.reference.1=..\\\\LibA\\\\
  # Project target.
  target=android-5
  android.library.reference.3=../LibC
  </code></pre>
  
  <p><br>build.xml of this project is used just to depend on Gradle tasks:</p>
  
  <pre><code>&lt;target name="-pre-build" depends="preBuild" /&gt;
  &lt;target name="-pre-compile" depends="preCompile" /&gt;
  
  &lt;import file="${sdk.dir}/tools/ant/build.xml" /&gt;
  </code></pre>
  
  <p><br>and build.gradle includes project's build.xml in the following way:</p>
  
  <pre><code>ant.property(file: 'local.properties')
  
  configurations {
      sdkDir = ant.properties['sdk.dir']
  }
  
  ant.importBuild "build.xml"
  </code></pre>
  
  <p><br>When I run this script with "release" target, I get the following error from Android's build.xml file:</p>
  
  <pre><code>[ERROR] [org.gradle.BuildExceptionReporter] Execution failed for task ':-build-setup'.
  [ERROR] [org.gradle.BuildExceptionReporter] Cause: The following error occurred while executing this line:
  [ERROR] [org.gradle.BuildExceptionReporter] Target "${build.target}" does not exist in the project "LibA".
  </code></pre>
  
  <p><br>which is caused by line 466 (the one containing "subant"):</p>
  
  <pre><code>&lt;!-- compile the libraries if any --&gt;
  &lt;if&gt;
      &lt;condition&gt;
          &lt;isreference refid="project.libraries" /&gt;
      &lt;/condition&gt;
      &lt;then&gt;
          &lt;echo&gt;Building Libraries&lt;/echo&gt;
          &lt;subant
                  buildpathref="project.libraries"
                  antfile="build.xml"
                  target="${build.target}"
                  failonerror="true"/&gt;
          &lt;echo&gt;&lt;/echo&gt;
          &lt;echo&gt;############################################&lt;/echo&gt;
          &lt;echo&gt;**** Back to project ${ant.project.name} ****&lt;/echo&gt;
          &lt;echo&gt;############################################&lt;/echo&gt;
      &lt;/then&gt;
  &lt;/if&gt;
  </code></pre>
  
  <p><br>So, the question is: does anybody know how to get rid of that error or how to properly use Android's build.xml in Gradle?<br><br></p>
  
  <p>Gradle-android-plugin is broken at the moment for android sdk >= r14 and thus I have resigned from depending on it. I use sdk tools r15.<br><br></p>
  
  <p>UPDATE:<br><br>
  It seems that neither</p>
  
  <pre><code>&lt;target name="-set-release-mode" depends="-set-mode-check"&gt;
  </code></pre>
  
  <p>nor</p>
  
  <pre><code>&lt;target name="-set-debug-mode"&gt;
  </code></pre>
  
  <p>is being called in Android's build.xml file, but I don't know why.</p>