Android Studio creates Jackson Parser setting on gradle

I am having problems adding a Jackson Parser dependency to my project.

I am currently using these lines of code on my build.gradle:

compile 'com.fasterxml.jackson.core:jackson-core:2.7.2' compile 'com.fasterxml.jackson.core:jackson-annotations:2.7.2' compile 'com.fasterxml.jackson.core:jackson-databind:2.7.2' 


The only class I need is ObjectMapper, which, as I know, is in the data package. When I added these lines to gradle, I pressed the sync button and everything was right.

The problem was starting the project on the emulator, this error appeared in messages in Android Studio:

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

com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied to APK META-INF / NOTICE File1: C: \ Users \ Igor.gradle \ caches \ modules-2 \ files -2.1 \ com.fasterxml.jackson.core \ JACKSON-DataBind \ 2.7.2 \ 84ffa765dd258dbab8695963c41308b054f3a1cb \ JACKSON-DataBind-2.7.2.jar File2: C: \ Users \ Igor.gradle \ caches \ modules-2 \ files-2.1 \ com.fasterxml.jackson.core \ JACKSON-kernel \ 2.7.2 \ 8b8310381b690e317f5f0574e9b2dd7034778b4c \ JACKSON-core-2.7.2.jar


I tried to leave only the data library, but I had no luck with this. The same error.

 compile 'com.fasterxml.jackson.core:jackson-databind:2.7.2' 


I tried Build -> Clean Project and deleted .gradle / cache and no luck.


I have no idea what it could be. Any suggestions?

+7
android jackson android-studio android-gradle
source share
2 answers

To completely solve the problem, I added everything:

  packagingOptions { exclude 'META-INF/DEPENDENCIES' exclude 'META-INF/NOTICE' exclude 'META-INF/LICENSE' exclude 'META-INF/LICENSE.txt' exclude 'META-INF/NOTICE.txt' } 
+8
source share

Add

 android { ... packagingOptions { exclude 'META-INF/NOTICE' // It is not include NOTICE file exclude 'META-INF/LICENSE' // It is not include LICENSE file } ... } 

in build.gradle .

+9
source share

All Articles