此测试原本运行良好。几天后检查出一个新的分支(来自许多其他开发者的提交),它不再有效。将在MyLibrary库模块中Robolectric找不到AndroidManifest.xml
测试类:
import com.company.mylibrary.BuildConfig;
@RunWith(RobolectricGradleTestRunner.class)
@Config(constants = BuildConfig.class, manifest = "src/main/AndroidManifest.xml", sdk = 21)
public class MyTest {
我也曾尝试:
@Config(constants = BuildConfig.class, sdk = 21)
@Config(constants = BuildConfig.class, manifest = Config.NONE, sdk = 21)
在库模块的build.gradle
dependencies {
.
.
testCompile 'org.robolectric:robolectric:3.0'
错误消息中运行时AS为: 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
错误信息是: com.company.mylibrary.framework1.feature1.MyTest > testMethod STANDARD_ERROR 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
A) Don't know why it is looking there for the manifest B) That file/directory does not exist C) src/main/AndroidManifest.xml does exist
事情我曾尝试: - deleted the build directory in that library module - restarted Android Studio - Build/Clean - Build/Rebuild Project - run the test (both inside AS and from command line) - and tried different versions of the @Config notation
似乎是在一个靠不住的状态,我不能清楚。
我正在使用MacBook Pro。 Android Studio 2.0 beta5
为我工作 - 谢谢截图! –