简体   繁体   English

com.android.dex.DexException:多个dex文件定义Lorg / hamcrest / Description;

[英]com.android.dex.DexException: Multiple dex files define Lorg/hamcrest/Description;

I've searched Stackoverflow for this error and found a lot of solutions and tried them all, none worked for me, for example changing junit to "4.8+" or adding these to build.gradle file: 我搜索了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'

I'm always getting this error : 我总是收到这个错误:

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

When changing junit to "4.8+" it says there's a conflict, and I need to make it 4.11. 当将junit更改为“4.8+”时,它表示存在冲突,我需要将其设为4.11。

What's the solution! 解决方案是什么!

通过以下方式替换它来解决:

androidTestCompile('junit:junit-dep:4.8.+')

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将字节码转换为dex:原因:com.android.dex.DexException:定义了多个dex文件 - converting bytecode to dex: Cause: com.android.dex.DexException: Multiple dex files define com.android.dex.DexException:多个dex文件定义了Lcom / google / android / gms / location / places / PlaceReport; - com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/location/places/PlaceReport; 错误:com.android.dex.DexException:多个dex文件定义了Ledu / umd / cs / findbugs / annotations / NonNull; - Error:com.android.dex.DexException: Multiple dex files define Ledu/umd/cs/findbugs/annotations/NonNull; com.android.dex.DexException:多个dex文件定义了Lcom / facebook / internal / Utility $ GraphMeRequestWithCacheCallback; - com.android.dex.DexException: Multiple dex files define Lcom/facebook/internal/Utility$GraphMeRequestWithCacheCallback; 意外的顶级异常:com.android.dex.DexException:多个dex文件定义 - UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexException: Multiple dex files define 意外的顶级异常:com.android.dex.DexException:多个dex文件定义 - UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexException: Multiple dex files define 将字节码转换为dex时出错:原因:com.android.dex.DexException:多个dex文件定义了Lcom / RNFetchBlob / RNFetchBlobConst; - Error converting bytecode to dex: Cause: com.android.dex.DexException: Multiple dex files define Lcom/RNFetchBlob/RNFetchBlobConst; 未知源文件:com.android.dex.DexException:多个dex文件定义了Lcom / google / android / gms / internal / zzpq; - Unknown source file : com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/internal/zzpq; 错误:将字节码转换为dex时出错:原因:com.android.dex.DexException:多个dex文件定义了Lcom / google / android / gms / common / api / zza; - Error:Error converting bytecode to dex: Cause: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/common/api/zza; Gradle 构建错误将字节码转换为 dex 时出错:原因:com.android.dex.DexException:多个 dex 文件定义 Landroid/arch/lifecycle/liveData$1 - Gradle build error Error converting bytecode to dex:Cause: com.android.dex.DexException:Multiple dex files define Landroid/arch/lifecycle/liveData$1
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM