title: Duplicate files during packaging of APK app-debug-unaligned.apk
body: <p>I got this error <code>Duplicate files during packaging of APK app-debug-unaligned.apk</code> when put 2 jar files :</p>
  
  <ul>
  <li><p><code>httpclient-4.3.5.jar</code></p></li>
  <li><p><code>httpmime-4.3.5.jar</code></p>
  
  <p>into the <code>libs</code> folder after <code>Sync with Gradle</code> and <code>Run</code>.</p></li>
  </ul>
  
  <p>If user 1 jar file - <code>httpmime-4.3.5.jar</code>, I will not get this error.</p>
  
  <p>Please help me how to avoid this error &amp; still can use 2 jar files in above also,</p>
  
  <p>Thanks,</p>
  
  <p>p/s : I use Android Studio version 0.8.6.</p>
  
  <p><code>Error Detail</code></p>
  
  <blockquote>
    <p>Error:duplicate files during packaging of APK 
    ...\app\build\outputs\apk\app-debug-unaligned.apk
        Path in archive: META-INF/DEPENDENCIES
        Origin 1: ...\app\libs\httpclient-4.3.5.jar
        Origin 2: ...\app\libs\httpmime-4.3.5.jar</p>
  </blockquote>
  
  <p><code>build.gradle</code></p>
  
  <pre><code>android {
  compileSdkVersion 20
  buildToolsVersion '20.0.0'
  defaultConfig {
      applicationId 'com.app'
      minSdkVersion 9
      targetSdkVersion 20
      versionCode 1
      versionName '1.0'
  }
  buildTypes {
      release {
          runProguard false
          proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
      }
  }
  productFlavors {
  }
  packagingOptions {
      exclude 'META-INF/LICENSE.txt'
  }
  
  dependencies {
  compile fileTree(include: ['*.jar'], dir: 'libs')
  compile 'com.android.support:support-v4:20.0.0'
  compile 'com.android.support:appcompat-v7:20.0.0'
  compile 'com.google.android.gms:play-services:5.2.08'
  compile 'com.viewpagerindicator:library:2.4.1@aar'
  compile 'de.hdodenhof:circleimageview:1.2.0'
  compile files('libs/httpmime-4.3.5.jar')
  }
  </code></pre>
  
  <p><code>UPDATE</code> I changed from <code>compile files('libs/httpmime-4.3.5.jar')</code> to use Maven Link. I got same error again after put 2 maven link together:</p>
  
  <pre><code>    compile 'org.apache.httpcomponents:httpmime:4.4-alpha1'
  compile 'org.apache.httpcomponents:httpcore:4.4-alpha1'
  </code></pre>
  
  <p>This is the warning</p>
  
  <blockquote>
    <p>Warning:Dependency org.apache.httpcomponents:httpclient:4.4-alpha1 is
    ignored for debug as it may be conflicting with the internal version
    provided by Android.
             In case of problem, please repackage it with jarjar to change the class packages </p>
    
    <p>Warning:Dependency
    org.apache.httpcomponents:httpclient:4.4-alpha1 is ignored for release
    as it may be conflicting with the internal version provided by
    Android.
             In case of problem, please repackage it with jar to change the class packages</p>
  </blockquote>
  
  <p>Please help me fix.</p>
  
  <p><strong>SOULITION</strong> I know good answer now by addding these lines will fix <code>Duplicate files</code> error :</p>
  
  <pre><code>packagingOptions {
      exclude 'META-INF/DEPENDENCIES.txt'
      exclude 'META-INF/LICENSE.txt'
      exclude 'META-INF/NOTICE.txt'
      exclude 'META-INF/NOTICE'
      exclude 'META-INF/LICENSE'
      exclude 'META-INF/DEPENDENCIES'
      exclude 'META-INF/notice.txt'
      exclude 'META-INF/license.txt'
      exclude 'META-INF/dependencies.txt'
      exclude 'META-INF/LGPL2.1'
  }
  </code></pre>