I am trying to add Jackson to my Android Studio project I do it by adding it to dependencies in gradle:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:19.+'
compile 'com.android.support:support-v4:19.+'
compile files('libs/universal-image-loader-1.9.2.jar')
compile 'com.google.android.gms:play-services:+'
compile 'com.fasterxml.jackson.core:jackson-databind:2.4.3'
}
Gradle build runs fine, however when I want to run tests in Android Studio it gives me the following error:
Error:Gradle: duplicate files during packaging of APK .../app/build/outputs/apk/app-debug-unaligned.apk
Error:Gradle: Execution failed for task ':app:packageDebug'.
Duplicate files copied in APK META-INF/LICENSE File 1: .../.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-annotations/2.4.3/a30ec6f59b6d31b2df06fa73925fda2fc7e84486/jackson-annotations-2.4.3.jar File 2: .../.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-annotations/2.4.3/a30ec6f59b6d31b2df06fa73925fda2fc7e84486/jackson-annotations-2.4.3.jar
I have tried invalidating caches in Android Studio, but it doesn't work. Can somebody help me, please?
You can exclude it adding this block to your build.gradle
:
android {
packagingOptions {
exclude 'META-INF/LICENSE.txt'
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With