使用Android Studio,当我尝试运行所有单元测试时,它几乎立即失败,并在Messages(Gradle Build)中出现以下错误:
Error:Gradle: Content is not allowed in prolog. Error:Gradle: Execution failed for task ':Module:mergeDebugAndroidTestResources'. > /Users/me/path/to/my/project/src/test/resources/fixtures/activity_feed.json:0:0: Error: Content is not allowed in prolog.似乎内容的另一个变体不允许在prolog错误中,这通常没有意义,因为我发现了搜索解决方案。 在我的例子中,它指向一个JSON文件,显然不包含任何prolog代码。
Using Android Studio, when I try to run all my Unit Tests, it fails almost immediately with following error in Messages (Gradle Build):
Error:Gradle: Content is not allowed in prolog. Error:Gradle: Execution failed for task ':Module:mergeDebugAndroidTestResources'. > /Users/me/path/to/my/project/src/test/resources/fixtures/activity_feed.json:0:0: Error: Content is not allowed in prolog.Seems like yet another variant of Content is not allowed in prolog error, which doesn't often makes sense, as I found out searching for a solution. In my case, it points to a JSON file, which obviously doesn't contain any prolog code.
最满意答案
查找构建变体视图:
左侧工具窗格 查看 - >工具窗口 - >构建变体在那里,找到:
测试工件: Android Instrumentation测试
而是Android Instrumentation Tests选择:
测试工件: 单元测试
Find Build Variants view:
left tool pane View -> Tool Windows -> Build VariantsOnce there, locate:
Test Artifact: Android Instrumentation Tests
and instead Android Instrumentation Tests select:
Test Artifact: Unit Tests
更多推荐
发布评论