gpt4 book ai didi

android - 测试运行开始测试运行失败 : Unable to find instrumentation info for: ComponentInfo{ro. vst.test/android.test.InstrumentationTestRunner}

转载 作者:行者123 更新时间:2023-11-28 20:17:51 30 4
gpt4 key购买 nike

这是我的 full code ,当我运行以下代码时,

public class KernelTest {
@Test
public void testM() {
assertEquals(1, 1);
}
}

它提高了:

Test running failed: Unable to find instrumentation info for: ComponentInfo{ro.vst.test/android.test.InstrumentationTestRunner}

最佳答案

我找到了解决方法:在android studio 1.5中,无论我是否指定runner,avd端都会生成一个名为“my_pkg_name.test/runner_name”的包名,解决步骤为:

  • 运行一次安卓测试
  • 我得到“测试运行失败:无法找到检测信息:ComponentInfo{ro.vst.test/android.test.InstrumentationTestRunner}”
  • 运行adb shell pm list instrumentation,找到pkg相关工具
  • 我得到“instrumentation:ro.vst.test/com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner
  • 这两个 TestRunner 不同,所以我在 build.gradle 中指定 TestRunner,如下所示

构建.gradle

defaultConfig {
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
}
  • 现在再次运行,应该可以了

关于android - 测试运行开始测试运行失败 : Unable to find instrumentation info for: ComponentInfo{ro. vst.test/android.test.InstrumentationTestRunner},我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34567366/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com