当我在Android Studio中运行Espresso测试时出现此错误。我尝试导入DaggerRuntime但仍然没有帮助。
java.lang.NoClassDefFoundError: android.support.test.espresso.base.BaseLayerModule_ProvideFailureHanderFactory
at android.support.test.espresso.DaggerBaseLayerComponent.initialize(DaggerBaseLayerComponent.java:66)
at android.support.test.espresso.DaggerBaseLayerComponent.<init>(DaggerBaseLayerComponent.java:54)
at android.support.test.espresso.DaggerBaseLayerComponent.<init>(DaggerBaseLayerComponent.java:40)
at android.support.test.espresso.DaggerBaseLayerComponent$Builder.build(DaggerBaseLayerComponent.java:123)
at android.support.test.espresso.DaggerBaseLayerComponent.create(DaggerBaseLayerComponent.java:62)
at android.support.test.espresso.GraphHolder.baseLayer(GraphHolder.java:42)
at android.support.test.espresso.Espresso.<clinit>(Espresso.java:51)
答案 0 :(得分:0)
尝试删除build.gradle文件中的支持库
androidTestCompile 'com.jakewharton.espresso:espresso:1.1-r3'
androidTestCompile ('com.jakewharton.espresso:espresso-support-v4:1.1-r3') {
exclude group:'com.android.support', module:'support-v4'
}