【问题标题】:Got java.lang.ClassNotFoundException error for ExampleInstrumentedTestExampleInstrumentedTest 出现 java.lang.ClassNotFoundException 错误
【发布时间】:2020-04-16 09:34:36
【问题描述】:

背景:

我试图触发基于仪器的猴子测试。但是当我运行并将 apk 推送到设备时,并运行以下命令:

adb shell am instrument -w -r -e runtime 1 -e debug false -e class com.kb.kbmonkey.ExampleInstrumentedTest com.kb.kbmonkey/androidx.test.runner.AndroidJUnitRunner

我收到以下错误:

原因:java.lang.ClassNotFoundException:在路径上找不到类“com.kb.kbmonkey.ExampleInstrumentedTest”...

所以我的问题是:
androidTest和test文件夹下的java文件是不是没有导出到apk中?

谢谢

【问题讨论】:

    标签: android-studio ui-automation android-uiautomator android-instrumentation


    【解决方案1】:

    你应该跑

    ./gradlew installDebugAndroidTest
    

    安装仪器测试。

    然后,您的命令可能会起作用。

    【讨论】:

      猜你喜欢
      • 2018-11-09
      • 1970-01-01
      • 1970-01-01
      • 2012-07-20
      • 1970-01-01
      • 1970-01-01
      • 2023-03-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多