title: External Android library projects with Gradle
body: <p>I am trying to build an Android project with Gradle and the <a href="http://tools.android.com/tech-docs/new-build-system/using-the-new-build-system">Android Gradle plugin</a>. I would like to depend on library projects found in external (maven) repositories, e.g. ActionBarSherlock. </p>
  
  <p>This seems possible according to the <a href="http://tools.android.com/tech-docs/new-build-system/using-the-new-build-system#TOC-Using-Library-Projects">official site</a>:</p>
  
  <blockquote>
    <p>Using a library is done one of the following way:</p>
    
    <p>Multi-project setup. Read here: <a href="http://www.gradle.org/docs/current/userguide/multi_project_builds.html">http://www.gradle.org/docs/current/userguide/multi_project_builds.html</a></p>
    
    <p><strong>Dependencies through a repo such as maven or ivy.</strong></p>
  </blockquote>
  
  <p>The current contents of my build.gradle:</p>
  
  <pre><code>buildscript {
      repositories {
          mavenCentral()
      }
      dependencies {
          classpath 'com.android.tools.build:gradle:0.2'
      }
  }
  apply plugin: 'android'
  
  repositories {
      mavenCentral()
  }
  
  dependencies {
      compile 'com.actionbarsherlock:library:4.2.0'
  }
  
  android {
      target = 'android-16'
      sourceSets {
          main {
              manifest {
                  srcFile 'AndroidManifest.xml'
              }
              java {
                  srcDir 'src'
              }
              res {
                  srcDir 'res'
              }
              assets {
                  srcDir 'assets'
              }
              resources {
                  srcDir 'src'
              }
          }
      }
  }
  </code></pre>
  
  <p>I am using Gradle 1.2. When I try to build with <code>gradle assemble</code>, I get the following error:</p>
  
  <pre><code>Error: duplicate files during packaging of APK /[path to project]/build/apk/[project name]-debug-unaligned.apk
      Path in archive: AndroidManifest.xml
      Origin 1: /[path to project]/build/libs/[apk name]-debug.ap_
      Origin 2: /[home directory]/.gradle/caches/artifacts-14/filestore/com.actionbarsherlock/actionbarsherlock/4.2.0/apklib/dd63451a922558005d8c10be1085b488ed731d19/actionbarsherlock-4.2.0.apklib
  :packageDebug FAILED
  </code></pre>
  
  <p>It seems like it is trying to include the AndroidManifest.xml from both the library project and my project. If I remove the <code>manifest</code> specification in <code>sourceSets</code>, I still get the same error. </p>
  
  <p>The site mentions using <code>apply plugin: 'android-library'</code> for library projects; I am guessing this is only when building the actual library (with a multi-project setup) since doing so does not produce an APK.</p>
  
  <p>How can I get external Android library project dependencies to work?</p>