2017-07-03 62 views
-2

的測試當我運行Android Studio中的咖啡測試中,我得到這個錯誤。我試圖導入DaggerRuntime但仍然沒有幫助。得到錯誤java.lang.NoClassDefFoundError同時運行androidTest儀表咖啡

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) 
+2

的[爲什麼會出現在Java中的NoClassDefFoundError?](可能的複製https://stackoverflow.com/questions/34413除去支持庫/爲什麼-AM-I-得到-A-NoClassDefFoundError的功能於JAVA) –

回答

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' 
}