简体   繁体   English

测试运行失败:由于“ java.lang.VerifyError”,测试运行失败

[英]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.

相关问题 Android Espresso UI测试-测试运行失败:由于“ java.lang.IllegalAccessError”,检测运行失败 - Android Espresso UI test - Test running failed: Instrumentation run failed due to 'java.lang.IllegalAccessError' Android:测试运行失败:由于&#39;java.lang.IncompatibleClassChangeError&#39;导致仪表运行失败 - Android: Test running failed: Instrumentation run failed due to 'java.lang.IncompatibleClassChangeError' 通过Espresso运行单元测试时,由于“ java.lang.ClassNotFoundException”错误,导致仪表运行失败 - Instrumentation run failed due to 'java.lang.ClassNotFoundException'error while running Unit test through Espresso “测试无法运行至完成。由于&#39;java.lang.NullPointerException,检测运行失败” - "Test failed to run to completion. Instrumentation run failed due to 'java.lang.NullPointerException'' 测试无法完成。 原因:由于“ java.lang.NullPointerException”,仪器运行失败 - Test failed to run to completion. Reason: 'Instrumentation run failed due to 'java.lang.NullPointerException'' 测试运行失败:由于“java.lang.ClassNotFoundException”,仪器运行失败 - Test run failed: Instrumentation run failed due to 'java.lang.ClassNotFoundException' KitKat 4.4上的测试框架失败:由于&#39;java.lang.ClassNotFoundException&#39;导致仪表运行失败 - Test Framework on KitKat 4.4 failed: Instrumentation run failed due to 'java.lang.ClassNotFoundException' java.lang.VerifyError:Verifier被拒绝的类 - 无法验证 - java.lang.VerifyError: Verifier rejected class - failed to verify 由于Robotium测试项目中带有“ Actionbar Sherlock”的“ java.lang.IllegalAccessError”,仪表运行失败 - Instrumentation run failed due to 'java.lang.IllegalAccessError' in Robotium test project with actionbar sherlock Android测试:由于&#39;java.lang.ClassNotFoundException&#39;导致Instrumentation运行失败 - Android Testing: Instrumentation run failed due to 'java.lang.ClassNotFoundException'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM