gpt4 book ai didi

java - com.android.dex.DexException : Multiple dex files define Lorg/hamcrest/Description;

转载 作者:太空宇宙 更新时间:2023-11-04 12:40:32 24 4
gpt4 key购买 nike

我在 Stackoverflow 上搜索了此错误,找到了很多解决方案并尝试了所有解决方案,但没有一个对我有用,例如将 junit 更改为“4.8+”或将它们添加到 build.gradle 文件中:

packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'LICENSE.txt'
}


androidTestCompile ('com.squareup:fest-android:1.0.+') {
exclude group: 'com.android.support'
}
androidTestCompile 'com.google.dexmaker:dexmaker:1.+'
androidTestCompile 'com.google.dexmaker:dexmaker-mockito:1.+'
androidTestCompile 'org.powermock:powermock-api-support:1.6.3'
androidTestCompile 'junit:junit:4.11'
androidTestCompile 'org.hamcrest:hamcrest-library:1.1'
androidTestCompile 'org.mockito:mockito-core:1.9.5'

我总是收到此错误:

Error:Error converting bytecode to dex:
Cause: com.android.dex.DexException: Multiple dex files define Lorg/hamcrest/Description;

Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_60\bin\java.exe'' finished with non-zero exit value 2

junit 更改为“4.8+”时,它表示存在冲突,我需要将其设为 4.11。

解决办法是什么!

最佳答案

通过将其替换为:

来解决
androidTestCompile('junit:junit-dep:4.8.+')

关于java - com.android.dex.DexException : Multiple dex files define Lorg/hamcrest/Description;,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36877805/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com