测试运行失败:由于'java.lang.VerifyError'导致仪表运行失败

时间:2014-06-25 17:40:48

标签: android runtime-error fest

我在尝试使用VerifyError编写和运行测试时遇到了可怕的fest-android。尝试加载我自己的一个类时发生错误:

  

java.lang.VerifyError:bbct / android / common / layout / test / BaseballCardDetailsLayoutTest

根据我所读到的,这意味着一个类不是DEX格式。但是这个类在我的Android Studio项目中,应该由构建过程转换。当然,正如我之前所说,我试图使用fest-android。除了在我的build.gradle文件中添加依赖项之外,我还需要做些什么吗?

更多信息:

仔细看看我的logcat,我发现了以下消息:

06-24 19:19:31.450  19696-19696/? W/dalvikvm﹕ Class resolved by unexpected DEX: Landroid/support/v7/app/ActionBarActivity;(0xb5734830):0xad59e000 ref [Landroid/support/v4/app/FragmentActivity;] Landroid/support/v4/app/FragmentActivity;(0xb5734830):0xad9b4000
06-24 19:19:31.450  19696-19696/? W/dalvikvm﹕ (Landroid/support/v7/app/ActionBarActivity; had used a different Landroid/support/v4/app/FragmentActivity; during pre-verification)
06-24 19:19:31.450  19696-19696/? W/dalvikvm﹕ Unable to resolve superclass of Landroid/support/v7/app/ActionBarActivity; (235)
06-24 19:19:31.450  19696-19696/? W/dalvikvm﹕ Link of class 'Landroid/support/v7/app/ActionBarActivity;' failed
06-24 19:19:31.450  19696-19696/? W/dalvikvm﹕ Unable to resolve superclass of Lbbct/android/common/activity/FragmentTestActivity; (723)
06-24 19:19:31.450  19696-19696/? W/dalvikvm﹕ Link of class 'Lbbct/android/common/activity/FragmentTestActivity;' failed
06-24 19:19:31.450  19696-19696/? E/dalvikvm﹕ Could not find class 'bbct.android.common.activity.FragmentTestActivity', referenced from method bbct.android.common.layout.test.BaseballCardDetailsLayoutTest.<init>

1 个答案:

答案 0 :(得分:1)

我终于可以通过从

更改build.gradle文件来解决此问题
androidTestCompile com.squareup:fest-android:1.0.8

androidTestCompile ('com.squareup:fest-android:1.0.8') {
    exclude group: 'com.android.support'
}