Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I got an error while building gradle in android studio [closed]

Tags:

android

Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.

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

like image 906
Balamasthan G Avatar asked Feb 09 '23 06:02

Balamasthan G


2 Answers

you might need to add this to your gradle file:

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'

    }
like image 128
Fred Grott Avatar answered Feb 10 '23 19:02

Fred Grott


in your app gradle file use 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'
 }
like image 37
iamdeowanshi Avatar answered Feb 10 '23 20:02

iamdeowanshi