我在尝试使用 Android 项目从 Eclipse 运行单元测试时遇到此错误。 Android 首选项中的 Instrumentation Test Runners 列表为空。
[2009-06-17 23:57:51 - MyApp] ERROR: Application does not specify a android.test.InstrumentationTestRunner instrumentation or does not declare uses-library android.test.runner
这也是令人恼火的决定,因为我尝试运行一次单元测试,这就是我一直想做的事情。
最佳答案
您可能在 AndroidManifest.xml
中缺少 uses-library
和 instrumentation
节点:
<manifest ...>
<application ...>
<!-- ... -->
<uses-library android:name="android.test.runner" />
</application>
<instrumentation android:name="android.test.InstrumentationTestRunner"
android:targetPackage="your.package"
android:label="your tests label" />
</manifest>
关于Android Eclipse 插件 : Instrumentation Test Runner not specified,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1009970/