问答

使用 Espresso 在小米真机上做 UI 测试失败,提示 Could not lau

作者:admin 2021-09-18 我要评论

我使用谷歌官方文档中推荐的 Espresso 在小米真机上做 UI 测试,出错,内容如下 : java.lang.RuntimeException: Could not launch intent Intent { act=android...

在说正事之前,我要推荐一个福利:你还在原价购买阿里云、腾讯云、华为云服务器吗?那太亏啦!来这里,新购、升级、续费都打折,能够为您省60%的钱呢!2核4G企业级云服务器低至69元/年,点击进去看看吧>>>)

我使用谷歌官方文档中推荐的 Espresso 在小米真机上做 UI 测试,出错,内容如下 :
java.lang.RuntimeException: Could not launch intent Intent { act=android.intent.action.MAIN flg=0x14000000 cmp=包名.要测试的 Activity 名 } within 45 seconds. Perhaps the main thread has not gone idle within a reasonable amount of time? There could be an animation or something constantly repainting the screen. Or the activity is doing network calls on creation? See the threaddump logs. For your reference the last time the event queue was idle before your activity launch request was 1582721904973 and now the last time the queue went idle was: 1582721914711. If these numbers are the same your activity might be hogging the event queue. at androidx.test.runner.MonitoringInstrumentation.startActivitySync(MonitoringInstrumentation.java:453) at androidx.test.rule.ActivityTestRule.launchActivity(ActivityTestRule.java:358) at androidx.test.rule.ActivityTestRule$ActivityStatement.evaluate(ActivityTestRule.java:529) at org.junit.rules.RunRules.evaluate(RunRules.java:20) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at androidx.test.runner.AndroidJUnit4.run(AndroidJUnit4.java:104) at org.junit.runners.Suite.runChild(Suite.java:128) at org.junit.runners.Suite.runChild(Suite.java:27) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at org.junit.runner.JUnitCore.run(JUnitCore.java:115) at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:56) at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:388) at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2160)

百度谷歌了一下午
1.确定没有耗时操作
2.确定没有自定义控件
3.确定没有各种形式的 ProgressBar
4.就是一些简单的点击操作
5.关闭了设置中有关动画过渡之类的选项
6.关闭了 MIUI 优化

同样的测试代码在华为手机上运行正常,在小米 8 和红米上却不行

有人遇到过吗?最后是怎么解决的呢?
小米手机的 API 是28

###

我是Smartisan R1 API26,搞一上午,换华为立马没问题...

###

换模拟器或者安装App后是默认能自动启动的手机

版权声明:本文转载自网络,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。本站转载出于传播更多优秀技术知识之目的,如有侵权请联系QQ/微信:153890879删除

相关文章
  • 使用 Espresso 在小米真机上做 UI 测试

    使用 Espresso 在小米真机上做 UI 测试

  • webpack 中 vue-loader怎么配置?

    webpack 中 vue-loader怎么配置?

  • vue怎么用watch实现无限树形,递归选中

    vue怎么用watch实现无限树形,递归选中

  • 初、高中数据题目(包含公式LaTex)相

    初、高中数据题目(包含公式LaTex)相

腾讯云代理商
海外云服务器