gradle - com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/maven/com.fasterxml.jackson.core/jackson-databind/pom.xml -


i creating 1 app uses restapi fetch data , , operation using retrofit 2 , okhttp3 , jackson parsing json object , app use firebase cloud messaging

when compile code gives me following error & can't able run it

error:execution failed task ':app:transformresourceswithmergejavaresfordebug'.

com.android.build.api.transform.transformexception: com.android.builder.packaging.duplicatefileexception: duplicate files copied in apk meta-inf/maven/com.fasterxml.jackson.core/jackson-databind/pom.xml file1: /users/silent/work/silentinfotech/dooreye/app/libs/jackson-databind-2.7.2.jar file2: /users/silent/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-databind/2.2.2/3c8f6018eaa72d43b261181e801e6f8676c16ef6/jackson-databind-2.2.2.jar

i using android studio 2.1.1 , os x ei capitan 10.11.2

some library added in projects libs folder

converter-jackson-2.0.2.jar

jackson-annotations-2.7.0.jar

jackson-core-2.7.2.jar

jackson-databind-2.7.2.jar

my build.gradle file

apply plugin: 'com.android.application'  android {     compilesdkversion 23     buildtoolsversion "23.0.2"      defaultconfig {         applicationid "com.silentinfotech.dooreye"         minsdkversion 17         targetsdkversion 23         versioncode 1         versionname "1.0"         multidexenabled true     }     buildtypes {         release {             minifyenabled false             proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro'         }     }     packagingoptions {          exclude 'meta-inf/license'         exclude 'meta-inf/notice'      } }  dependencies {     compile filetree(include: ['*.jar'], dir: 'libs')     testcompile 'junit:junit:4.12'     compile 'com.android.support:appcompat-v7:23.4.0'    // compile 'com.android.support:support-v4:23.4.0'     compile 'com.google.firebase:firebase-messaging:9.0.0'     compile 'com.firebase:firebase-client-android:2.5.1+'    // compile 'com.github.bumptech.glide:glide:3.7.0'     compile 'com.squareup.retrofit2:retrofit:2.0.2'     compile 'com.squareup.okhttp3:okhttp:3.2.0'     compile 'com.squareup.okhttp3:logging-interceptor:3.0.1'  } apply plugin: 'com.google.gms.google-services' 

i tried adding following in build.gradle file don't work me

    packagingoptions {
    
         exclude 'meta-inf/license'
         exclude 'meta-inf/notice'
    
     } 

also tried invalidate caches & restart , , rebuild , clean , tried manually deleting caches still give me error

i using firebase cloud messaging in project when remove dependancy of firebase cloud messaging project run when add fcm dependancy give error

instead of

packagingoptions {          exclude 'meta-inf/license'         exclude 'meta-inf/notice'      } 

try this

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

and more thing

remove line

apply plugin: 'com.google.gms.google-services' 

from bottom , add top after apply plugin: 'com.android.application'.

apply plugin: 'com.android.application' apply plugin: 'com.google.gms.google-services' 

update :

just remove

compile filetree(dir: 'libs', include: '*.jar') 

and apply dependencies.


Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -