[英]Test running failed: Instrumentation run failed due to 'java.lang.VerifyError'
I am getting the dreaded VerifyError
when attempting to write and run a test using fest-android
. 尝试使用
fest-android
编写和运行测试时,出现可怕的VerifyError
。 The error occurs when attempting to load one of my own classes: 尝试加载我自己的类之一时发生错误:
java.lang.VerifyError: bbct/android/common/layout/test/BaseballCardDetailsLayoutTest
java.lang.VerifyError:bbct / android / common / layout / test / BaseballCardDetailsLayoutTest
According to what I have read, this means that a class isn't in DEX format. 根据我阅读的内容,这意味着类不是DEX格式的。 But this class is in my Android Studio project and should be converted by the build process.
但是此类在我的Android Studio项目中,应在构建过程中进行转换。 Of course, as I said earlier, I'm trying to use
fest-android
. 当然,正如我之前所说,我正在尝试使用
fest-android
。 Is there something special I need to do other than add the dependency in my build.gradle
file? 除了在
build.gradle
文件中添加依赖项之外,我build.gradle
需要执行其他特殊操作吗?
More information: 更多信息:
Taking a closer look at my logcat, I found the following message: 仔细查看我的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>
I was finally able to solve this problem by changing my build.gradle
file from 我终于可以通过更改
build.gradle
文件来解决此问题
androidTestCompile com.squareup:fest-android:1.0.8
to 至
androidTestCompile ('com.squareup:fest-android:1.0.8') {
exclude group: 'com.android.support'
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.