我试图在Firebase测试实验室平台上运行一些测试,但我发现了一个问题:
错误:任务':app:transformClassesWithJarMergingForDebugAndroidTest'执行失败。
com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:junit / extensions / ActiveTestSuite $ 1.class
当我在虚拟设备中本地运行测试时,测试工作正常。
我整天都在这里工作,我找不到有效的解决方案:(
这是我的依赖:
依赖{ 编译fileTree(dir:' libs',include:[' * .jar'])
// Dagger
// apt command comes from the android-apt plugin
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.appyvet:materialrangebar:1.3'
compile 'com.google.firebase:firebase-core:11.0.2'
compile 'com.google.android.gms:play-services-maps:11.0.2'
compile 'com.google.android.gms:play-services-location:11.0.2'
compile 'com.google.firebase:firebase-appindexing:11.0.2'
compile 'com.google.android.gms:play-services-analytics:11.0.2'
compile 'com.google.android.gms:play-services-gcm:11.0.2'
compile 'com.google.firebase:firebase-messaging:11.0.2'
compile 'com.google.firebase:firebase-config:11.0.2'
compile 'com.google.firebase:firebase-auth:11.0.2'
compile 'com.google.firebase:firebase-invites:11.0.2'
compile 'com.google.firebase:firebase-perf:11.0.2'
compile 'com.google.firebase:firebase-crash:11.0.2'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.7.5'
compile 'com.squareup.okhttp3:okhttp:3.3.1'
compile 'com.squareup.okio:okio:1.7.0'
compile 'info.guardianproject.netcipher:netcipher:1.2'
compile 'com.appsflyer:af-android-sdk:4.7.1'
compile 'com.android.volley:volley:1.0.0'
compile 'com.google.dagger:dagger:2.9'
testCompile 'junit:junit:4.12'
testCompile 'org.robolectric:robolectric:3.1.4'
testCompile 'org.robolectric:shadows-multidex:3.0'
testCompile 'org.mockito:mockito-core:1.10.19'
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support:support-annotations:25.3.1'
androidTestCompile 'com.android.support.test:testing-support-lib:0.1'
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2') {
exclude module: 'javax.annotation-api'
exclude module: 'support-annotations'
}
androidTestCompile ('com.android.support.test.uiautomator:uiautomator-v18:2.1.2') {
exclude module: 'javax.annotation-api'
exclude module: 'support-annotations'
}
androidTestCompile('com.android.support.test.espresso:espresso-contrib:2.2.2') {
// Necessary to avoid version conflicts
exclude module: 'support-v4'
exclude module: 'recyclerview-v7'
exclude module: 'appcompat-v7'
exclude module: 'support-annotations'
exclude module: 'design'
}
annotationProcessor 'com.google.dagger:dagger-compiler:2.9'
provided 'javax.annotation:jsr250-api:1.0'
非常感谢
答案 0 :(得分:0)
我首先要确定哪些库正在使用具有该名称的类。
Android Studio您可以使用open file
并输入ActiveTestSuite。这将自动完成所有匹配的类。例如,当我这样做时,它似乎来自一个junit类。
我不确定为什么你只会在Firebase上看到这个。可能会看到是否有标志以确保测试版本在运行之前运行 clean 操作。