ibm - Duplicate Entry Error - Dependancy and Project Module Confliction - Android -


first of all. below error getting.

error img-1

error img-2

now, doing below....

i integrating speech text service of ibm. have founded demo here!

i using 2 services of ibm named personality insights , cloudant database.

i have integrated speech text example. when integrate personality insights , cloudant database gives me above error.

what have identified:

  • in stt demo there module called speech-android-wrapper.
  • which have included app , added line *build.gradle** file compile project(':speech-android-wrapper').
  • for cloudant database service have dependency compile group: 'com.cloudant', name: 'cloudant-sync-datastore-android', version: 'latest.release'.
  • when comment cloudant database dependency. won't give me above error.
  • so, these 2 dependencies being conflicts.

below application's build.gradle file.

build.gradle

buildscript {     repositories {         maven { url 'https://maven.fabric.io/public' }     }      dependencies {         classpath 'io.fabric.tools:gradle:1.+'     } } apply plugin: 'com.android.application' apply plugin: 'io.fabric'  android {     compilesdkversion 23     buildtoolsversion "23.0.2"      packagingoptions {         exclude 'meta-inf/notice.txt'         exclude 'meta-inf/license.txt'     }      defaultconfig {         multidexenabled true         applicationid "com.stt_int.android01.sttdemofour"         minsdkversion 15         targetsdkversion 23         versioncode 1         versionname "1.0"     }     buildtypes {         release {             minifyenabled false             proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro'         }     } }  repositories {     // ... other project repositories     jcenter()     maven { url 'https://maven.fabric.io/public' } }  dependencies {     compile filetree(include: ['*.jar'], dir: 'libs')     testcompile 'junit:junit:4.12'     compile 'com.android.support:appcompat-v7:23.2.0'     compile project(':speech-android-wrapper')     compile 'com.facebook.android:facebook-android-sdk:4.7.+'     compile 'com.mcxiaoke.volley:library:1.0.19'     /*compile('com.mopub:mopub-sdk:4.3.0@aar') {         transitive = true     }*/     compile('com.twitter.sdk.android:twitter:1.13.0@aar') {         transitive = true;     }     compile 'com.ibm.watson.developer_cloud:java-sdk:2.6.0'     compile group: 'com.cloudant', name: 'cloudant-sync-datastore-android', version: 'latest.release' } 

below speech-android-wrapper module's build.gradle file

apply plugin: 'com.android.library'  android {     compilesdkversion 21     buildtoolsversion '22.0.1'     defaultconfig {         minsdkversion 9         targetsdkversion 16     }     buildtypes {         release {             minifyenabled false             proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.txt'         }     }     productflavors {     } }  dependencies {     compile files('libs/java_websocket.jar')     compile files('libs/commons-io-2.4.jar')     compile files('libs/jna.jar') } 

i have try exclude byteordermark.class class using below code can not desire outcome.

android { packagingoptions { exclude 'org/apache/commons/io/byteordermark.class' } }

any very very appreciated. thanks!!

update-1: dated: 28.03.2016

i have tried below 2 links suggested @nikolay shmyrev none of links worked me.

from 1st link.
dependencies { compile files('libs/java_websocket.jar') //compile files('libs/commons-io-2.4.jar') compile('commons-io:commons-io:2.4') { exclude group: 'org.apache', module: 'commons-io' } compile files('libs/jna.jar') }

from 2nd link.
dependencies { compile files('libs/java_websocket.jar') //compile files('libs/commons-io-2.4.jar') compile('commons-io:commons-io:2.4') { exclude group: 'org.apache.commons.io' } compile files('libs/jna.jar') }
have removed commons-io-2.4.jar file libs folder of speech-android-wrapper module.

update-2: dated: 29.03.2016

i have tried below too.

dependencies { compile filetree(include: ['*.jar'], dir: 'libs') testcompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:23.2.0' compile project(':speech-android-wrapper') compile 'com.facebook.android:facebook-android-sdk:4.7.+' compile 'com.mcxiaoke.volley:library:1.0.19' /*compile('com.mopub:mopub-sdk:4.3.0@aar') { transitive = true }*/ compile('com.twitter.sdk.android:twitter:1.13.0@aar') { transitive = true; } compile 'com.ibm.watson.developer_cloud:java-sdk:2.6.0' compile(group: 'com.cloudant', name: 'cloudant-sync-datastore-android', version: 'latest.release') { exclude group: 'org.apache', module: 'commons-io' } }

below also..

dependencies { compile filetree(include: ['*.jar'], dir: 'libs') testcompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:23.2.0' compile project(':speech-android-wrapper') compile 'com.facebook.android:facebook-android-sdk:4.7.+' compile 'com.mcxiaoke.volley:library:1.0.19' /*compile('com.mopub:mopub-sdk:4.3.0@aar') { transitive = true }*/ compile('com.twitter.sdk.android:twitter:1.13.0@aar') { transitive = true; } compile 'com.ibm.watson.developer_cloud:java-sdk:2.6.0' compile(group: 'com.cloudant', name: 'cloudant-sync-datastore-android', version: 'latest.release') { exclude group: 'org.apache.commons.io' } }

to project's build.gradle file. while have changed project's build.gradle file, build.gradle file of speech-android-wrapper below.

dependencies { compile files('libs/java_websocket.jar') //compile files('libs/commons-io-2.4.jar') compile 'commons-io:commons-io:2.4' compile files('libs/jna.jar') }

but nothing works me.

i not sure can work.

the issue happens because adding same class (org/apache/commons/io/byteordermark.class) twice.

if checking pom file of com.cloudant:cloudant-sync-datastore-android library find dependency:

commons-io:commons-io:2.4 

in speech-android-wrapper module can:

  • remove commons-io-2.4.jar libs folder
  • change dependencies in build.gradle removing line compile files('libs/commons-io-2.4.jar') , adding compile commons-io:commons-io:2.4

Comments