Unable to resolve activity for: Intent when instrumentation-testing android activities

谁说我不能喝 提交于 2019-12-01 06:54:03
<?xml version="1.0" encoding="utf-8"?>

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.mycompany.mobile.android.gui"
... ...

Are you using the same package name for both your Android project and Android test project? This could be a problem, though I am not sure if it causes your java.lang.RuntimeException.

According to the official dev guide here, Your test project must have a different package name from you tested project:

An Android package name is a unique system name for a .apk file, set by the "android:package" attribute of the element in the package's manifest. The Android package name of your test package must be different from the Android package name of the application under test. By default, Android tools create the test package name by appending ".test" to the package name of the application under test.

Try using package name com.mycompany.mobile.android.gui.test for your test project.

You are running it as an Android Project, try running it as a Android Test Project

adb shell am instrument -e package <java package> -w <test apk package>/android.test.InstrumentationTestRunner

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!