如何解决Android 重复类重复类 javax.inject.Inject
我将一个 android studio 项目克隆到另一台 PC。在那之后,我开始收到一堆错误。
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)
这些类存在于两个单独的 jar
中(javax.inject-1.jar
和 sisu-inject-bean-1.4.2.jar
)。所以我尝试删除其中一个依赖项,但失败了,Studio 只是在缓存无效并重新启动后将它们添加回来。
我无法提升 gradle 的版本,因为有一个存储库(第 3 方)不能与高于 gradle-5.1.1 的 gradle 版本一起使用
安卓工作室版本:4.1.2
构建工具版本为 classpath 'com.android.tools.build:gradle:3.4.2'
JDK 1.8
而且我的依赖项部分中也没有这些库。那些 jars 刚刚添加到我的后台构建中(不知道它是如何工作的)。
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',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',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',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.- 该项目在另一台 PC 上运行良好。
那么有没有办法解决这个问题?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。