我在android studio中构建gradle时遇到错误

时间:2015-12-19 17:48:56

标签: android

错误:任务':app:transformResourcesWithMergeJavaResForDebug'的执行失败。

  

com.android.build.api.transform.TransformException:com.android.builder.packaging.DuplicateFileException:在APK META-INF / NOTICE中复制的重复文件       File1:C:\ Users \ Balamasthan G.gradle \ caches \ modules-2 \ files-2.1 \ com.fasterxml.jackson.core \ jackson-databind \ 2.2.2 \ 3c8f6018eaa72d43b261181e801e6f8676c16ef6 \ jackson-databind-2.2.2.jar       File2:C:\ Users \ Balamasthan G.gradle \ _caches \ modules-2 \ files-2.1 \ com.fasterxml.jackson.core \ jackson-core \ 2.2.2 \ d20be6a5ddd6f8cfd36ebf6dea329873a1c41f1b \ jackson-core-2.2.2.jar < / p>

2 个答案:

答案 0 :(得分:7)

您可能需要将其添加到您的gradle文件中:

packagingOptions {

        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/ASL2.0'

    }

答案 1 :(得分:1)

在你的app gradle文件中使用multidex:enabled

android {
      compileSdkVersion 22
      buildToolsVersion "23.0.0"

      defaultConfig {
         minSdkVersion 14 //lower than 14 doesn't support multidex
         targetSdkVersion 22

         // Enabling multidex support.
         multiDexEnabled true
     }
}

dependencies {
compile 'com.android.support:multidex:1.0.1'
 }