Roboelectic 不工作说 "AndroidManifest.xml not found or not a file"

Roboelectic not working says "AndroidManifest.xml not found or not a file"

我正在尝试 运行 Robolectric 在 MacOS Sierra 中进行测试,但它抛出了这个错误:

AndroidManifest.xml not found or not a file; it should point to your project's AndroidManifest.xml".

我已经将编辑配置 → 工作目录设置为 $MODULE_DIR$。

Caused by: java.lang.RuntimeException: build/intermediates/manifests/full/debug/AndroidManifest.xml not found or not a file; it should point to your project's AndroidManifest.xml
at org.robolectric.manifest.AndroidManifest.validate(AndroidManifest.java:121)
at org.robolectric.manifest.AndroidManifest.getResourcePath(AndroidManifest.java:469)
at org.robolectric.manifest.AndroidManifest.getIncludedResourcePaths(AndroidManifest.java:475)
at org.robolectric.RobolectricTestRunner.createAppResourceLoader(RobolectricTestRunner.java:491)
at org.robolectric.RobolectricTestRunner.getAppResourceLoader(RobolectricTestRunner.java:483)
at org.robolectric.internal.ParallelUniverse.setUpApplicationState(ParallelUniverse.java:73)
at org.robolectric.RobolectricTestRunner.setUpApplicationState(RobolectricTestRunner.java:433)
at org.robolectric.RobolectricTestRunner.evaluate(RobolectricTestRunner.java:240)

如果您在 Mac 上,或者 运行 正在使用 Linux 机器,您很可能 运行 遇到了 Android Studio 不会将工作目录设置为正在测试的模块。要解决此问题,您需要编辑 运行 配置、Defaults -> JUnit 并将工作目录值更改为 $MODULE_DIR$.

http://robolectric.org/getting-started/enter image description here