Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
295 views
in Technique[技术] by (71.8m points)

java - Android duplicate class Duplicate class javax.inject.Inject

I cloned an android studio project to another PC. After that I started to get a bunch of errors.

Duplicate class javax.inject.Inject found in modules javax.inject-1.jar (javax.inject:javax.inject:1) and sisu-inject-bean-1.4.2.jar (org.sonatype.sisu:sisu-inject-bean:1.4.2)
Duplicate class javax.inject.Named found in modules javax.inject-1.jar (javax.inject:javax.inject:1) and sisu-inject-bean-1.4.2.jar (org.sonatype.sisu:sisu-inject-bean:1.4.2)
Duplicate class javax.inject.Provider found in modules javax.inject-1.jar (javax.inject:javax.inject:1) and sisu-inject-bean-1.4.2.jar (org.sonatype.sisu:sisu-inject-bean:1.4.2)
Duplicate class javax.inject.Qualifier found in modules javax.inject-1.jar (javax.inject:javax.inject:1) and sisu-inject-bean-1.4.2.jar (org.sonatype.sisu:sisu-inject-bean:1.4.2)
Duplicate class javax.inject.Scope found in modules javax.inject-1.jar (javax.inject:javax.inject:1) and sisu-inject-bean-1.4.2.jar (org.sonatype.sisu:sisu-inject-bean:1.4.2)
Duplicate class javax.inject.Singleton found in modules javax.inject-1.jar (javax.inject:javax.inject:1) and sisu-inject-bean-1.4.2.jar (org.sonatype.sisu:sisu-inject-bean:1.4.2)

Those classes exist in two separate jars (javax.inject-1.jar and sisu-inject-bean-1.4.2.jar). So I tried to remove one of the dependencies, but failed, Studio just add them back after invalidating cache and restart.

I can't raise the version of gradle because there is a repository (3rd party) that just doesn't work with gradle version higher than gradle-5.1.1

Android studio version: 4.1.2
Build tools version is classpath 'com.android.tools.build:gradle:3.4.2'
JDK 1.8

And also i dont have those libraries in my dependencies section. Those jars just added to my build in background (dont acctually undertand how it works).

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile files('libs/hoinsdk.jar')
    androidTestImplementation 'com.squareup.okhttp:mockwebserver:1.3.0'
    androidTestCompile('com.android.support.test.espresso:espresso-core:3.0.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    androidTestCompile('com.android.support.test.espresso:espresso-core:3.0.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    androidTestImplementation 'com.android.support.test.espresso:espresso-web:3.0.2'
    androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'
    androidTestCompile('com.android.support.test.espresso:espresso-contrib:3.0.2') {
        exclude group: 'com.android.support', module: 'appcompat'
        exclude group: 'com.android.support', module: 'support-v4'
        exclude group: 'com.android.support', module: 'support-annotations'
        exclude module: 'recyclerview-v7'
    }

    // Does not matter if we have this part or not. The error is still the same :(
    implementation("org.sonatype.sisu:sisu-inject-bean:1.4.2",{
        exclude group: 'org.sonatype.sisu',module: 'app'
    })
    // ---------------------------------------------------------------

    androidTestImplementation('com.android.support.test.espresso:espresso-intents:2.2.2')
    androidTestCompile files('libs/hoinsdk.jar')
    testCompile files('libs/hoinsdk.jar')
    compile files('libs/sunmiscan.jar')

    implementation fileTree(include: ['*.arr'], dir: 'libs')
    implementation(name: 'PayLib-release-1.3.14', ext: 'aar')

    implementation('com.github.bumptech.glide:okhttp3-integration:1.4.0') {
        exclude group: 'glide-parent'
    }
    implementation 'com.ru.ingenico.pclextended:Arcus2AndroidExtended-debug:@aar'
    implementation files('libs/usdk_api_aidl_v2.0.0.20180130.jar')
    implementation files('libs/usdk_api_aidl_v2.0.0.20180130.jar')
    implementation 'com.warrenstrange:googleauth:1.1.1'
    implementation 'commons-io:commons-io:2.4'
    implementation 'com.squareup.okhttp3:okhttp:4.6.0'
    implementation 'com.squareup.okhttp3:okhttp-urlconnection:4.6.0'

    api 'com.google.dagger:dagger:2.25.4'
    annotationProcessor 'com.google.dagger:dagger-compiler:2.25.4'

    testCompile 'com.warrenstrange:googleauth:1.1.1'
    androidTestCompile 'commons-io:commons-io:2.4'
    implementation 'com.warrenstrange:googleauth:1.1.1'
    implementation 'commons-io:commons-io:2.4'
    implementation 'com.squareup.okhttp3:okhttp:3.10.0'
    implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.9.0'
    implementation 'ru.appex:mcash-sdk:6.0'
    implementation 'com.googlecode.json-simple:json-simple:1.1.1'
    implementation 'com.google.code.gson:gson:2.8.4'
    implementation 'junit:junit:4.12'
    implementation 'org.apache.commons:commons-lang3:3.6'
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.android.support:design:28.0.0'
    implementation 'commons-codec:commons-codec:1.10'
    implementation 'com.journeyapps:zxing-android-embedded:3.5.0'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'org.springframework.android:spring-android-rest-template:2.0.0.M3'
    implementation 'com.fasterxml.jackson.core:jackson-databind:2.9.1'
    implementation 'com.fasterxml.jackson.core:jackson-core:2.9.1'
    implementation 'com.fasterxml.jackson.core:jackson-annotations:2.9.0'
    implementation 'me.dm7.barcodescanner:zxing:1.9.7'
    implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
    implementation 'io.reactivex.rxjava2:rxjava:2.1.9'
    implementation 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
    implementation 'com.squareup.retrofit2:retrofit:2.4.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
    implementation 'com.squareup.okhttp3:logging-interceptor:3.9.0'
    implementation 'com.nimbusds:nimbus-jose-jwt:5.1'
    implementation 'io.card:android-sdk:5.5.1'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.brandongogetap:stickyheaders:0.5.1'
    implementation 'io.fotoapparat.fotoapparat:library:2.2.0'
    implementation 'com.sunmi:DS_Lib:1.0.11'
    implementation 'com.alibaba:fastjson:1.1.67.android'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    testCompile 'com.warrenstrange:googleauth:1.1.1'
    testCompile 'junit:junit:4.12'
    testCompile 'com.googlecode.json-simple:json-simple:1.1.1'
    androidTestCompile 'commons-io:commons-io:2.4'
    androidTestCompile 'org.apache.commons:commons-lang3:3.6'
    androidTestCompile 'ru.appex:mcash-sdk:6.0'
    androidTestCompile 'commons-codec:commons-codec:1.10'
//    androidTestCompile 'com.google.guava:guava:24.1-jre'

    implementation 'com.jakewharton:butterknife:9.0.0-rc1'
    annotationProcessor 'com.jakewharton:butterknife-compiler:9.0.0-rc1'

    // For paymob
    implementation deps.support.multidex
    implementation deps.okhttp.core
    implementation deps.okhttp.logger
    implementation deps.guavaAndroid
    implementation deps.retrofit.core
    implementation deps.retrofit.converterGson
    implementation deps.retrofit.rxjava2Adapter
    implementation deps.rx.core
    implementation deps.rx.android
    implementation deps.logback.core
    implementation deps.retro_stream
    implementation(deps.logback.classic) {
        exclude group: 'com.google.android', module: 'android'
    }
    implementation deps.greendao
    implementation deps.timber
    implementation deps.paperdb
    implementation deps.slf4jApi

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

    implementation(group: 'roamlib', name: 'roamlib2', version: '196')

    implementation(group: 'm4bank', name: 'zlibrary', version: '2159', ext: 'aar')
    implementation(group: 'm4bank', name: 'cardreaderlib', version: '759')
    implementation(group: 'm4bank', name: 'connectionreaders', version: '759')
    implementation(group: 'external', name: 'emv-taglib', version: '2.5')

    // ================= Aisino ===============
    implementation(group: 'm4bank', name: 'aisino_common', version: '140')
    implementation(group: 'm4bank', name: 'aisinoprinterlib', version: '153')
    implementation(group: 'm4bank', name: 'aisino_a90lib', version: '438')
    implementation(group: 'm4bank', name: 'aisino_a90deps', version: 'master-1.1.43', ext: 'aar')
    implementation(group: 'm4bank', name: 'asinalib', version: '75')
    implementation(group: 'm4bank', name: 'spirelib', version: '79')
    implementation(group: 'm4bank', name: 'fiscalprinterlibrary', version: '62')

    // =============== Wangpos ===============
    implementation(group: 'm4bank', name: 'wangposlib', version: '53')
    implementation(group: 'm4bank', name: 'wangposprinterlibrary', version: '35', ext: 'aar')
    implementation(group: 'external', name: 'SDK4BaseBinder', version: '2.1.5')
    implementation(group: 'external', name: 'SDK4EmvBinder', version: '2.1.5')
    implementation(group: 'external', name: 'SDK4KeyManagerBinder', version: '2.1.5')


    implementation(group: 'm4bank', name: 'd200lib', version: '4')
    implementation(group: 'm4bank', name: 'icmplibrary', version: '16')
    implementation(group: 'm4bank', name: 'FptrServiceAndroid', version: '3')

    // Use response
    implementation 'com.getbase:floatingactionbutton:1.10.1'
//    implementation project(path:':useresponse', configuration: 'default')
    androidTestImplementation 'com.android.support.test:rules:1.0.2'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'

    // File downloading
    implementation "com.tonyodev.fetch2:fetch2:3.0.11"

    // Glide
    implementation 'com.github.bumptech.glide:annotations:4.11.0'
    implementation 'com.github.bumptech.glide:glide:4.9.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
    implementation('com.github.bumptech.glide:okhttp3-integration:4.4.0') {
        exclude group: 'glide-parent'
    }

    // =============== NPAS ===================
    def openSdkProject = findProject(':Android_Opensdk')
    if (openSdkProject != null)
        implementation openSdkProject
    else
        implementation fileTree(dir: 'libs', include: ['*.jar'])

    def payLibProject = findProject(':Android_PayLib')
    if (payLibProject != null)
        implementation payLibProject
    else
        implementation files('libs/Android_SecPayLib-pax-compass-release.aar')

    def halApiProject = findProject(':Android_Hal_Api')
    if (halApiProject != null)
        implementation halApiProject

    implementation "android.arch.persistence.room:runtime:1.1.1"
    implementation "org.bouncycastle:bcprov-jdk15on:1.56"
    implementation "org.bouncycastle:bcpkix-jdk15on:1.56"
    implementation 'org.greenrobot:eventbus:3.2.0'
    compile files('libs/GLPage_V1.01.00_20171222.jar')
}

P.S.- that project just works fine on another PC.

So is there a way to fix this problem?

question from:https://stackoverflow.com/questions/65882655/android-duplicate-class-duplicate-class-javax-inject-inject

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...