当前位置: 首页 > 知识库问答 >
问题:

如何查找导致类重复的依赖关系?

卫昊东
2023-03-14

当我构建android项目时,它显示“重复类”异常,

1 exception was raised by workers:   java.lang.RuntimeException:
java.lang.RuntimeException:
Duplicate class android.arch.core.executor.DefaultTaskExecutor found in modules classes.jar (android.arch.core:core:1.0.0-alpha1) and classes.jar(android.arch.core:runtime:1.1.1)   
Duplicate class android.arch.core.executor.TaskExecutor found in modules classes.jar (android.arch.core:core:1.0.0-alpha1) and classes.jar (android.arch.core:runtime:1.1.1)**

App.Gradle

android {
compileSdkVersion 28
buildToolsVersion ’28.0.3’

defaultConfig {
     minSdkVersion 18
    targetSdkVersion 28

    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    multiDexEnabled true

    javaCompileOptions {
        annotationProcessorOptions {
            arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
        }
    }

}
dependencies {
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.9'
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})

implementation ’org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.31’api('com.google.maps:google-maps-services:0.9.3') {
    exclude group: 'com.google.code.findbugs', module: 'jsr305'
}
implementation 'com.android.support:appcompat-v7:28.0.0’
implementation 'com.android.support:design:28.0.0'
implementation 'com.google.android.exoplayer:exoplayer:2.8.2’
implementation 'android.arch.persistence.room:runtime:1.0.0-alpha1' 
annotationProcessor 'android.arch.persistence.room:compiler:1.0.0-alpha1' 
implementation 'com.jakewharton.rxbinding:rxbinding:1.0.1'
implementation 'com.google.android.gms:play-services-maps:16.1.0'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.google.android.gms:play-services-analytics:16.0.8'
implementation 'com.google.android.gms:play-services-places:16.1.0'

implementation 'com.google.maps.android:android-maps-utils:0.5'

implementation 'com.google.firebase:firebase-messaging:17.6.0'
implementation 'com.google.firebase:firebase-core:16.0.8'
implementation 'com.google.firebase:firebase-auth:16.2.1'
implementation 'com.facebook.android:facebook-android-sdk:5.0.0'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.14.1'
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
implementation 'com.squareup.retrofit2:adapter-rxjava:2.5.0'
implementation 'io.reactivex:rxandroid:1.2.1'
implementation 'io.reactivex:rxjava:1.3.8'
implementation 'com.artemzin.rxjava:proguard-rules:1.3.3.0'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.1'
implementation 'org.eclipse.paho:org.eclipse.paho.android.service:1.1.1'
implementation 'de.hdodenhof:circleimageview:3.0.0'
implementation ('com.github.bumptech.glide:glide:4.9.0') {
    exclude group: "com.android.support"
}
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
implementation 'com.googlecode.libphonenumber:libphonenumber:8.10.11'
implementation project(':lib-zxing')
implementation 'com.googlecode.mp4parser:isoparser:1.1.22'
implementation 'com.github.lassana:continuous-audiorecorder:1.3.1'
implementation 'me.leolin:ShortcutBadger:1.1.22@aar'
implementation 'com.timehop.stickyheadersrecyclerview:library:0.4.3'
implementation 'org.jsoup:jsoup:1.11.3'
testImplementation 'junit:junit:4.13-beta-2'
}

Lib-Zxing

 android {
compileSdkVersion 28
buildToolsVersion ’28.0.3’

defaultConfig {
    minSdkVersion 14
    targetSdkVersion 28

    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

}dependencies {
api fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})

implementation 'com.android.support:appcompat-v7:28.0.0’
testImplementation 'junit:junit:4.13-beta-2'
}

共有1个答案

长孙永思
2023-03-14

你需要排除拱形罐子。首先,检查副本来自哪里。如果使用分级任务打印依赖项树,您可以看到它:

./gradlew -q dependencies app:dependencies --configuration compile

然后像您对glide所做的那样排除旧的拱形罐,但使用正确的排除,例如:

implementation ('android.arch.persistence.room:runtime:1.0.0-alpha1') {
    exclude group: "android.arch.core"
}
 类似资料:
  • 我们在堆大小为512M的IBM J9 VM上运行weblogic服务器。 今天,服务器因OutOfMemory错误而失败。 我使用Eclipse Memory Analyzer打开了堆转储文件xxx.phd(安装了IBM DTFJ pluign以支持。phd文件)。 垫子给我一份泄漏嫌疑人报告,像这样: 我如何找到创建这个大数组的类? 或者任何帮助我识别大数组的提示?

  • 问题内容: 我正在构建一个android应用程序,并且正在使用recaptcha和easywsdl存储库。这两个存储库都包含okhttp和okio jars,并且在启动存在重复类的应用程序时出现错误。但是,这些并不相同。如果我从项目中排除okhttp(由recaptcha存储库添加),则recaptcha不会具有由recaptcha添加的okhttp.jar中描述的特定方法。 代码段:http :

  • 我知道循环依赖通常是不被鼓励的——然而,在C#和TypeScript中,我有时发现它们很有用。这可能是因为我缺乏python方面的经验,也可能是因为我的思维方式不对,或者是因为我没有找到谷歌应该使用的词语。我将如何解决以下问题? 我试图创建一个处理请求的类,每个处理事件都伴随着一个上下文。所以,我想创建handler类和context类,但它们是依赖的,linter在第2行给了我问题,说Handl

  • 这是关于cppreference的描述。com说 模板中使用的依赖名称的查找将推迟到模板参数已知时,此时[…]ADL检查从模板定义上下文或模板实例化上下文可见的具有外部链接的函数声明。 与此相反,以下代码段可以使用三个编译器(MSVC、clang、gcc)很好地编译: Foo是CallFoo中的从属名称:它取决于模板参数T。但是,尽管违反了上述两条规则,编译器还是找到了函数Foo。 从的定义或实例

  • 我是毕业生的新手,我需要配置我的构建.gradle文件。我正在使用硒网络驱动程序,我有.jar文件列表。我如何将此jar文件作为依赖项包含在我的build.gradle文件中?我有这个.jar在我的包中一个名为lib的文件夹中。我有 }但是我一直有下面的错误: 失败:生成失败,出现异常。 其中:构建文件“/主页/ola/工作区/构建分级”行: 20 出错了:评估根项目“工作区”时出现问题。无法将对

  • 问题内容: 我想找出哪些软件包依赖于已安装的软件包等。是否有子命令或其他方法可在本地列出一个特定npm软件包的所有反向依赖项? 问题答案: 在之后添加软件包名称将仅显示具有指定软件包的树。