Android Studio trouble setting up Jackson Parser on gradle

Viewed 10818

I'm having trouble adding the Jackson Parser dependency to my project.

Currently I'm 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 the ObjectMapper that I know it is in databind package. When I added these lines in the gradle I pressed the sync and everything did correctly.

The problem was running the project on the emulator, this error showed up in Messages in Android Studio:

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\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-core\2.7.2\8b8310381b690e317f5f0574e9b2dd7034778b4c\jackson-core-2.7.2.jar


I tried to left only the databind library but I got no lucky with that. Same error.

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


I tried Build -> Clean Project and deleting the .gradle/cache but no luck either.


I have no clue what this could be. Any suggestions?

3 Answers
implementation 'com.squareup.retrofit2:converter-jackson:2.7.2'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.10.3'
implementation 'com.fasterxml.jackson.core:jackson-core:2.10.3'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.10.3'

try this..

ref :-

https://mobikul.com/how-to-use-jackson-parser/

Related