【问题标题】:Android ExampleInstrumentedTest running fails with "Test framework quit unexpectedly"Android ExampleInstrumentedTest 运行失败并显示“测试框架意外退出”
【发布时间】:2021-05-01 17:07:34
【问题描述】:

我所有的 androidTests 错误:

05/01 21:24:26: Launching 'ExampleInstrumentedT...' on Nexus 5 API R.
Install successfully finished in 1 s 870 ms.
Running tests

$ adb shell am instrument -w -m    -e debug false -e class 'com.mrahimy.mytestapplication10.ExampleInstrumentedTest' com.mrahimy.mytestapplication10.test/androidx.test.runner.AndroidJUnitRunner
Test running failed: Process crashed.
Tests ran to completion.

这里的消息说:Test running failed: Process crashed.

logcat中还有一条相关信息:

RuntimeException: Unable to find instrumentation info for: 
ComponentInfo{com.mrahimy.mytestapplication10.test/androidx.test.runner.AndroidJUnitRunner

这只是Android Studio 4.1.3中file -> new project中选择“Fragment + ViewModel”或“No Activity”创建的模板项目

仪器化测试的例子就是这样。我没有做任何改变。 gradle 包装器版本是gradle-6.5-bin.zip。 kotlin 版本是 1.4.32,gradle 工具版本是 4.1.3

我搜索了 stackoverflow,答案要么适用于以前版本的 Android Studio,要么问题来自完全不同的框架。

那么我该怎么做才能查看配置有什么问题呢?

【问题讨论】:

    标签: android android-studio testing android-instrumentation


    【解决方案1】:

    固定:

    首先,我更换了我的模拟器并使用了一个 API 28 的模拟器,它运行良好。 但是,基准测试模块也不能为任何 API 级别的模拟器或物理设备运行。但是我从我的 gradle 脚本中删除了这个依赖,现在它运行良好:

    androidTestImplementation "androidx.work:work-testing:2.7.0-alpha04

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-11-28
      • 2019-11-10
      • 2017-04-03
      • 2020-03-20
      • 2014-08-25
      • 2016-01-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多