androidbuild.gradleconflicting-librariesinstrumented-test

More than one file was found with OS independent path 'org/apache/commons/csv/QuoteMode.java'


As far as I have read the other link regarding similar issues like this, there is always the issue of 2 libraries conflicting, I think that's the case with me too but can anyone tell me which library is causing the conflict or what is the issue and how do I resolve this issue? Below is my Gradle, and I only get this one line error in my stack trace. Any help would be appreciated. This error only comes when I run any instrumented test in this package, I have other packages as libraries, and all of those tests run fine, but I can't run any instrumented test in this package.

apply plugin: 'com.android.library'

android {
    compileSdkVersion rootProject.ext.compileSdkVersion


defaultConfig {
    minSdkVersion rootProject.ext.minSdkVersion
    targetSdkVersion rootProject.ext.targetSdkVersion

    versionCode rootProject.ext.versionCode
    versionName rootProject.ext.versionName

    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    consumerProguardFiles 'consumer-rules.pro'
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
}
testOptions {
    unitTests.returnDefaultValues = true
}
compileOptions {
    sourceCompatibility = 1.8
    targetCompatibility = 1.8
}

}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation fileTree(dir: '../../extlibs/apache-common-csv', include: ['*.jar'])

implementation 'com.amazonaws:aws-android-sdk-core:2.16.0'
implementation 'com.amazonaws:aws-android-sdk-s3:2.13.7'
implementation('com.amazonaws:aws-android-sdk-mobile-client:2.16.0@aar') { transitive = true }
implementation('com.amazonaws:aws-android-sdk-auth-userpools:2.16.0@aar') { transitive = true }

implementation 'com.loopj.android:android-async-http:1.4.9'
implementation 'org.apache.commons:commons-lang3:3.7'
implementation 'org.apache.commons:commons-io:1.3.2'
implementation 'com.opencsv:opencsv:4.2'
implementation 'androidx.appcompat:appcompat:1.1.0'

implementation 'androidx.room:room-runtime:2.2.5'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'

implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.1.0'

implementation 'androidx.paging:paging-runtime:2.1.2'
implementation 'androidx.paging:paging-rxjava2:2.1.2'

testImplementation 'org.json:json:20190722'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'androidx.annotation:annotation:1.1.0'
implementation project(path: ':roomdblib')

}


Solution

  • I read alot of ther links similar to this error, but I couldn't not find a solution for me, but it didn't cross my mind to check for these too lines. first:

    check if you have set this in you build.gradle->dependencies

    implementation fileTree(include: ['*.jar'], dir: 'libs')
    

    if you've set this in you build.gradle file then check for this too if you tried to import libraries from your libs directory:

    implementation files('libs/...')
    

    if you have this too in your build.gradle file, please remove it or comment it out, because you are trying to re-import the library again which result is that error.