I got an error while building gradle in android studio

Error: execution completed for task ': app: transformResourcesWithMergeJavaResForDebug'.

com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: duplicate files copied to the 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

+4
source share
2 answers

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'

    }
+7

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'
 }
+1

Source: https://habr.com/ru/post/1620906/


All Articles