title: Android Gradle Duplicate files copied in APK META-INF/license.txt
body: <p>I'm going to add RESTful Web Service support with Spring to my Android application as described here <a href="https://spring.io/guides/gs/consuming-rest-android/">https://spring.io/guides/gs/consuming-rest-android/</a>.</p>
  
  <p>This is top-level build.gradle config:</p>
  
  <pre><code>// Top-level build file where you can add configuration options common to all sub-projects/modules.
  buildscript {
      repositories {
          jcenter()
      }
      dependencies {
          classpath 'com.android.tools.build:gradle:2.1.0'
      }
  }
  
  allprojects {
      repositories {
          jcenter()
      }
  }
  </code></pre>
  
  <p>This is my <code>app/build.gradle</code> config:</p>
  
  <pre><code>apply plugin: 'com.android.application'
  
  android {
      compileSdkVersion 23
      buildToolsVersion "23.0.3"
  
      defaultConfig {
          applicationId "com.example"
          minSdkVersion 8
          targetSdkVersion 17
      }
  
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
          }
      }
  
      dependencies {
          compile 'com.android.support:appcompat-v7:+'
          compile fileTree(dir: 'libs', include: ['*.jar'])
          compile 'org.springframework.android:spring-android-rest-template:1.0.1.RELEASE'
          compile 'com.fasterxml.jackson.core:jackson-databind:2.3.2'
      }
  
      packagingOptions {
          exclude 'META-INF/NOTICE' // will not include NOTICE file
          exclude 'META-INF/LICENSE' // will not include LICENSE file
      }
  
  }
  </code></pre>
  
  <p>Right now it fails with a following error:</p>
  
  <pre><code>FAILURE: Build failed with an exception.
  
  * What went wrong:
  Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.
  &gt; com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/license.txt
      File1: user\.gradle\caches\modules-2\files-2.1\org.springframework.android\spring-android-rest-template\1.0.1.RELEASE\e132d929bd181941f79b0d63edafb8a86ae6fd33\spring-android-rest-template-1.0.1.RELEASE.jar
      File2: user\.gradle\caches\modules-2\files-2.1\org.springframework.android\spring-android-core\1.0.1.RELEASE\e68f0e8e4b636ee30c4de58953be38d9b72a5e3b\spring-android-core-1.0.1.RELEASE.jar
  </code></pre>
  
  <p>What am I doing wrong and how to fix it ?</p>