Reputation: 249
I am trying to use the Watson java wrapper in my android project. When I just add
compile 'com.ibm.watson.developer_cloud:java-wrapper:0.1.4'
to my gradle, I am getting Duplicate files found in META-INF/LICENSE
error. Do anyone know's how to fix this ?
My build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.cool.myapp"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.ibm.watson.developer_cloud:java-wrapper:0.1.4'
}
The Messages Gradle
display me this
Error:duplicate files during packaging of APK /Users/Shaik/Downloads/AskAshiq/app/build/outputs/apk/app-debug-unaligned.apk
Path in archive: META-INF/DEPENDENCIES
Origin 1: /Users/Shaik/.gradle/caches/modules-2/files-2.1/org.apache.james/apache-mime4j/0.6/945007627e8d12275d755081a9e609c018e1210d/apache-mime4j-0.6.jar
Origin 2: /Users/Shaik/.gradle/caches/modules-2/files-2.1/org.apache.httpcomponents/httpcore/4.0.1/e813b8722c387b22e1adccf7914729db09bcb4a9/httpcore-4.0.1.jar
You can ignore those files in your build.gradle:
android {
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
}
}
Error:Execution failed for task ':app:packageDebug'.
> Duplicate files copied in APK META-INF/DEPENDENCIES
File 1: /Users/Shaik/.gradle/caches/modules-2/files-2.1/org.apache.james/apache-mime4j/0.6/945007627e8d12275d755081a9e609c018e1210d/apache-mime4j-0.6.jar
File 2: /Users/Shaik/.gradle/caches/modules-2/files-2.1/org.apache.httpcomponents/httpcore/4.0.1/e813b8722c387b22e1adccf7914729db09bcb4a9/httpcore-4.0.1.jar
Adding this also does not help
packagingOptions {
exclude 'META-INF/LICENSE'
}
Upvotes: 1
Views: 516
Reputation: 1148
try to exclude all files by adding.
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'
}
Upvotes: 1