Error in Android --Unable to find instrumentation info for: ComponentInfo

好久不见. 提交于 2019-12-06 03:43:31

Directory structure should be:

src
  package.x.y.z.test
      MainTest.java
      CustomInstrumentationRunner.java

Then in the AndroidManifest.xml, set

<manifest package="package.x.y.z" ...

<instrumentation
        android:name="package.x.y.z.test.CustomInstrumentationRunner"

Invoke the above package with the command line:

adb shell am instrumentation -w package.x.y.z/package.x.y.z.test.CustomInstrumentationRunner

An Instrumentation implementation is described to the system through an AndroidManifest.xml's <instrumentation> tag.

I solved this problem by doing the following:

  1. Use a upper-level package name in the manifest:

  2. Implement the test packages one level down: Java file 1:

    package com.xxx.yyy.zzz.ptest.onlylogin;

Java file 2:

package com.xxx.yyy.zzz.ptest.register;
  1. Specify the command line like the following:

    ...

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