I got this error Duplicate files during packaging of APK app-debug-unaligned.apk when put 2 jar files :
httpclient-4.3.5.jar
httpmime-4.3.5.jar
into the libs folder after Sync with Gradle and Run.
If user 1 jar file - httpmime-4.3.5.jar, I will not get this error.
Please help me how to avoid this error & still can use 2 jar files in above also,
Thanks,
p/s : I use Android Studio version 0.8.6.
Error Detail
Error:duplicate files during packaging of APK
...\app\build\outputs\apk\app-debug-unaligned.apk
Path in archive: META-INF/DEPENDENCIES
Origin 1: ...\app\libs\httpclient-4.3.5.jar
Origin 2: ...\app\libs\httpmime-4.3.5.jar
build.gradle
android {
compileSdkVersion 20
buildToolsVersion '20.0.0'
defaultConfig {
applicationId 'com.app'
minSdkVersion 9
targetSdkVersion 20
versionCode 1
versionName '1.0'
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:support-v4:20.0.0'
compile 'com.android.support:appcompat-v7:20.0.0'
compile 'com.google.android.gms:play-services:5.2.08'
compile 'com.viewpagerindicator:library:2.4.1#aar'
compile 'de.hdodenhof:circleimageview:1.2.0'
compile files('libs/httpmime-4.3.5.jar')
}
UPDATE I changed from compile files('libs/httpmime-4.3.5.jar') to use Maven Link. I got same error again after put 2 maven link together:
compile 'org.apache.httpcomponents:httpmime:4.4-alpha1'
compile 'org.apache.httpcomponents:httpcore:4.4-alpha1'
This is the warning
Warning:Dependency org.apache.httpcomponents:httpclient:4.4-alpha1 is
ignored for debug as it may be conflicting with the internal version
provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
Warning:Dependency
org.apache.httpcomponents:httpclient:4.4-alpha1 is ignored for release
as it may be conflicting with the internal version provided by
Android.
In case of problem, please repackage it with jar to change the class packages
Please help me fix.
SOULITION I know good answer now by addding these lines will fix Duplicate files error :
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'
}
You can replace compile files('libs/httpmime-4.3.5.jar') with this compile 'org.apache.httpcomponents:httpmime:4.3.5'.
Also you are duplicating the dependencies compile fileTree(include: ['*.jar'], dir: 'libs') already includes compile files('libs/httpmime-4.3.5.jar')
update your build.gradle and add the following lines
android{
.
.
.
packagingOptions {
exclude 'META-INF/license.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/notice.txt'
exclude 'META-INF/NOTICE'
}
}
this will fix this error. I got the same error, doing this fixed it.
Please update this to your build.gradle file.
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
I updated gradle now it's working
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
add the below code to dependencies
compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5'
compile (group: 'org.apache.httpcomponents' , name: 'httpmime' , version: '4.3.5') {
exclude module: 'org.apache.httpcomponents:httpclient'
}
now if you run that it will show you why it is telling duplicate may be because of META-INF/NOTICE, META-INF/LICENSE, add that first again run it may show other type.
add all like below under android section
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
}
definitely it will solve your problem.
remove all the dependancy file from the system before build.
Related
Hi after adding apache poi gradle build , Im getting this expection. Could you please explain me what it is how to resolve it.
I have tried excluding package options in many ways, didn't worked
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.1.0'
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:25.1.0'
compile 'com.android.support:cardview-v7:25.1.0'
compile 'org.greenrobot:greendao:3.2.0'
compile group: 'org.apache.poi', name: 'poi-ooxml', version: '3.9'
}
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/LICENSE
File1: /home/surendra/.gradle/caches/modules-2/files-2.1/org.apache.poi/poi-ooxml-schemas/3.9/4c514498f0e82cccfdd3208b9caff2f45158db4a/poi-ooxml-schemas-3.9.jar
File2: /home/surendra/.gradle/caches/modules-2/files-2.1/org.apache.poi/poi-ooxml/3.9/bbe83c739d22eecfacd06d7e0b99ba13277040ed/poi-ooxml-3.9.jar
File3: /home/surendra/.gradle/caches/modules-2/files-2.1/org.apache.poi/poi/3.9/5d5e41354e88322e4bc590b31f3d2d1d52b3e6ac/poi-3.9.jar
try this exclude the duplicated file by using below code
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
pickFirst 'META-INF/license.txt'
}
Go to your build.gradle file and add the following line:
packagingOptions {
exclude 'META-INF/LICENSE.txt'
}
In my case I had to add like this one:
apply plugin: 'com.android.library'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:+'
compile 'com.google.android.gms:play-services:6.5.87'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.mcxiaoke.volley:library:1.0.15'
compile 'com.google.code.gson:gson:2.2.4'
compile "org.apache.httpcomponents:httpcore:4.4.1"
compile "org.apache.httpcomponents:httpmime:4.3.6"
}
For better reference visit this answer.
exclude the duplicated file by adding this to you gradle file
android {
...
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}
Running Error Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'
So I'm continuously receiving a gradle build error upon trying to run my project. I have searched for other solutions and some say that adding:
packagingOptions {
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE' // will not include LICENSE file
// as noted by #Vishnuvathsan you may also need to include
// variations on the file name. It depends on your dependencies.
// Some other common variations on notice and license file names
exclude 'META-INF/notice'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license'
exclude 'META-INF/license.txt'
}
But it doesn't work for me.The Error as below:
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/rxjava.properties
**File1: E:\Workspace_Android\TravelStory\app\build\intermediates\exploded-aar\cn.bmob.android\bmob-sdk\3.5.0\jars\classes.jar
File2: C:\Users\Prometheus\.gradle\caches\modules-2\files-2.1\io.reactivex\rxjava\1.2.1\4e4cfa4adc74521d5966799fa5ab70b733552f68\rxjava-1.2.1.jar**
I try to delete the File2 but after compile/gradle the file created again.
studio version is 2.2.3
gradle version is 2.2.3
My gradle file content as below:
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.example.travelstory.travelstory"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
multiDexEnabled true;
}
packagingOptions {
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE' // will not include LICENSE file
// as noted by #Vishnuvathsan you may also need to include
// variations on the file name. It depends on your dependencies.
// Some other common variations on notice and license file names
exclude 'META-INF/notice'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license'
exclude 'META-INF/license.txt'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:3.0.1'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support:design:25.0.1'
compile 'com.android.support:multidex:1.0.1'
//屏幕自动适配
compile 'com.zhy:autolayout:1.4.5'
//注解框架
compile 'com.jakewharton:butterknife:8.4.0'
apt 'com.jakewharton:butterknife-compiler:8.4.0'
//6.0权限rx
compile 'com.tbruyelle.rxpermissions:rxpermissions:0.9.1#aar'
//RxJava RxLifecycle生命周期管理
compile 'com.trello:rxlifecycle:1.0'
compile 'com.trello:rxlifecycle-components:1.0'
//3.5.0:请务必查看下面注释[1]
compile ('cn.bmob.android:bmob-sdk:3.5.0')
// {
// exclude group: 'io.reactivex:rxjava:1.1.6'
// }
//如果你想应用能够兼容Android6.0,请添加此依赖(org.apache.http.legacy.jar)
compile 'cn.bmob.android:http-legacy:1.0'
//bmob-push:Bmob的推送包
compile 'cn.bmob.android:bmob-push:0.8'
//多fragment多模块Activity
compile 'me.yokeyword:fragmentation:0.9.3'
// 如果想使用SwipeBack 滑动边缘退出Fragment/Activity功能,请再添加下面的库
compile 'me.yokeyword:fragmentation-swipeback:0.7.9'
}
Your not excluding the file the error is warning about.
com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/rxjava.properties
Here the complaint is META-INF/rxjava.properties so just update your packageOptions block to exclude this file explicitly.
packagingOptions {
exclude 'META-INF/rxjava.properties'
// ... and any other excludes go here
}
Update your gradle with this code:
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
}
This happens when there is a duplication of libraries
I am using below 2 lib's in project
1. spring-core-3.1.0.RELEASE.jar
2. spring-web-3.1.0.RELEASE.jar
But android studio is considering duplicate entry for above lib's and giving error while packaging.
Error:duplicate files during packaging of APK E:\Code\iDoc\app\build\outputs\apk\app-debug-unaligned.apk
Path in archive: META-INF/license.txt
Origin 1: E:\Code\iDoc\app\libs\spring-core-3.1.0.RELEASE.jar
Origin 2: E:\Code\iDoc\app\libs\spring-web-3.1.0.RELEASE.jar
You can ignore those files in your build.gradle:
android {
packagingOptions {
exclude 'META-INF/license.txt'
}
}
------------------------------------------------------------
Anybody faced similar problem ?
Please suggest some-work around for this error.
Go to your build.gradle file and add the following line:
packagingOptions {
exclude 'META-INF/license.txt'
}
In my case I had to add like this one:
apply plugin: 'com.android.library'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:+'
compile 'com.google.android.gms:play-services:6.5.87'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.mcxiaoke.volley:library:1.0.15'
compile 'com.google.code.gson:gson:2.2.4'
compile "org.apache.httpcomponents:httpcore:4.4.1"
compile "org.apache.httpcomponents:httpmime:4.3.6"
}
Note:
Meta-files doesn't affect any programmatic functions of application. Meta files basically contains Textual information like legal-notice, Licences etc of open sources libraries. Excluding it will not affect any thing.
When we use multiple 3rd party open source libraries, sometimes 2 or more projects has same named text files (Example: License.txt or Notice.txt or dependencies.txt). That causes the conflict during build time. In that moment our mighty android studio suggest us to exclude those conflicting meta files.
Important: When excluding the files note that it is case sensitive
I added this to my gradle and it was not working:
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
I was gettting error:
Duplicate files copied in APK META-INF/notice.txt
So the fix is to add META-INF/notice.txt :
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
}
I have most simple solution for txt files. If you remove all txt files in the dependency.
Only add this block.
packagingOptions {
exclude '**/*.txt'
}
I'm using Android Studio, and for other projects, when I try to Generate a signed APK I get the app-release.apk file with any further trouble.
But in this particular project, I can only get an app-release-unaligned.apk file.
The main difference with my other projects is the use of the transloadit jar and org.apache.httpcomponents library for which I had to write down the packagingOptions field in my graddle file.
This is my build.grade file
apply plugin: 'com.android.application'
android {
signingConfigs {
}
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.bambinotes.bambinotessnap"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
zipAlignEnabled true
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENCE'
exclude 'META-INF/LICENSE'
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'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile('org.apache.httpcomponents:httpmime:4.3.6') {
exclude module: 'httpclient'
}
compile files('libs/transloadit-1.0.2.jar')
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.anupcowkur:reservoir:2.0'
compile 'com.android.support:cardview-v7:22.2.0'
compile 'com.android.support:recyclerview-v7:22.2.0'
compile 'com.google.android.gms:play-services:7.5.0'
compile 'com.mcxiaoke.volley:library:1.0.16'
compile 'org.apache.httpcomponents:httpclient-android:4.3.5'
compile 'com.android.support:support-v4:22.2.0'
}
** UPDATE**
I've just found out what was the error that I was having, Android Studio was opening the finder in another folder, the one that generates the app-debug and app-release-unaligned files (which we can consider as intermediate files), the app-release.apk file was two folders up in the directory structure.
Even though I feel embarrassed for knowing the reason of my trouble, I'll leave this question open to see if this happens to anyone else in the future.
The app-release.apk file is in the application folder.
Sometimes Android studio shows another directory where the unaligned file is, so you just have to look for the newly created file.
You need to add the signing configuration to your Gradle file, see this answer for more information How to create a release signed apk file using Gradle?
After I have updated my Studio from 0.3.7 to 0.4.0, I can't compile my project. I found a solution on stackoverflow: Duplicate files copied (Android Studio 0.4.0)
I updated my project to gradle 0.7.+, but I don't know where I must put the next strings:
android {
packagingOptions {
exclude 'META-INF/LICENSE.txt'
}
}
My logcat: log
Execution failed for task ':Prog:packageDebug'.
> Duplicate files copied in APK META-INF/LICENSE.txt
File 1: /home/scijoker/AndroidStudioProjects/ProgProject/Prog/libs/httpclient-4.1.1.jar
File 2: /home/scijoker/AndroidStudioProjects/ProgProject/Prog/libs/httpclient-4.1.1.jar
P.S. Develop in ubuntu 13.04
Putting the dependecies at the top and the packageOptions at the end worked for me.
apply plugin: 'android'.
Here is my full build.gradle at the app folder.
dependencies {
compile 'com.android.support:support-v4:+'
compile files('libs/apache-mime4j-0.6.jar')
compile files('libs/httpmime-4.0.jar')
}
android {
compileSdkVersion 19
buildToolsVersion "19.0.1"
defaultConfig {
minSdkVersion 7
targetSdkVersion 10
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard- rules.txt'
}
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'
}
}
EDIT: Almost all OS licence include the obligation to "include a copy of the licence" into your project. So this means, that you have to include a copy of all OS licences you use into you projects. By "excluding" them in gradle, you violate the licences.
Excluding them from the project might not be the best option.
Thank you R.S. for the info.
Attention!! Possible OpenSource license violation.
With excluding license.txt files as proposed above you may violate some opensource licenses as it is a common point in opensource licences to agree to add it to your source.
Better check your opensource licences.
Update:
Until there is a better solution, use
packagingOptions {
pickFirst 'META-INF/license.txt'
}
like this you at least fulfill a part of the license obligation
You also can try:
packagingOptions {
merge 'META-INF/license.txt'
}
just add
android {
packagingOptions {
exclude 'META-INF/LICENSE.txt'
}
}
in build.gradle
You can fix it by adding the following code to project/app/build.gradle:
android {
// Fixed build error : Duplicate files copied in APK META-INF/xxx
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/LICENSE.txt'
}
}
I was facing the same problem as per new version of gradle, Below build.gradle text format work for me :
There are two jackson jars in my libs folder.
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.omtlab.myapplication"
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'libs/jackson-core-asl-1.9.13.jar'
exclude 'libs/jackson-mapper-asl-1.9.13.jar'
exclude 'META-INF/ASL2.0'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
}
dependencies {
//compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:21.0.3'
compile files('libs/jackson-core-asl-1.9.13.jar')
compile files('libs/jackson-mapper-asl-1.9.13.jar')
}
Adding:
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
}
worked for me, biniam_Ethiopia's solution is probably the most fail-safe
While inserting this code
android{
packagingOptions{
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
}
}
MAKE SURE if in error it is showing
> Duplicate files copied in APK META-INF/LICENSE.txt
then add
android{
packagingOptions{
exclude 'META-INF/LICENSE.txt'
}
}
if in error it is showing
> Duplicate files copied in APK META-INF/LICENSE
then add
android{
packagingOptions{
exclude 'META-INF/LICENSE'
}
}
if in error it is showing
> Duplicate files copied in APK META-INF/license.txt
then add
android{
packagingOptions{
exclude 'META-INF/license.txt'
}
}
In short text CASE and document FORMAT(.txt) is so important.
(this error exist in Android Studio 1.1.0 also)
This will help you solve the problem
packagingOptions {
exclude 'META-INF/ASL2.0'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/DEPENDENCIES'
}
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'
}
Add in build.gradle file and syn project
I just add 2:
android{
packagingOptions{
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/LICENSE'
}
}
This may very well be bad practice, however if you are including multiple large libraries, you may find yourself working through hundreds of these kinds of conflicts.
Listed below is a super-simple fix for such cases:
android {
....
packagingOptions {
// Allow the compilation process to choose the dependencies for us.
pickFirst "**"
}
}
I had a similar error and solved it without the packingOptions() and exclude function. I was adding two dependencies but one was a sub-group of the first. This caused the error, once I removed one of them I got a clean build. I recommend checking for a similar error within your dependency block.
When using java-jwt and jackson-core together use following:
exclude("META-INF/maven/com.fasterxml.jackson.core/jackson-annotations/pom.properties")
exclude("META-INF/maven/com.fasterxml.jackson.core/jackson-annotations/pom.xml")
exclude("META-INF/maven/com.fasterxml.jackson.core/jackson-core/pom.properties")
exclude("META-INF/maven/com.fasterxml.jackson.core/jackson-core/pom.xml")
exclude("META-INF/maven/com.fasterxml.jackson.core/jackson-databind/pom.properties")
exclude("META-INF/maven/com.fasterxml.jackson.core/jackson-databind/pom.xml")