android - 在 Android Studio 中运行覆盖率测试时出现 StackOverflowError
问题描述
我一直在我的项目中编写一些测试,当通过命令行使用./gradlew test
或从 Android Studio 运行测试时,通过单击“在 java 中运行测试”,所有测试都成功执行。但是,当我尝试使用覆盖率运行所有测试时,出现以下错误,并且有一些测试未执行:
---- IntelliJ IDEA coverage runner ----
sampling ...
include patterns:
exclude patterns:
Exception in thread "main"
Exception: java.lang.StackOverflowError thrown from the UncaughtExceptionHandler in thread "main"
Class transformation time: 0.823138756s for 3466 classes or 2.3748954298903635E-4s per class
Exception in thread "Thread-2"
Exception: java.lang.StackOverflowError thrown from the UncaughtExceptionHandler in thread "Thread-2"
[2021.06.28 16:28:50] (Coverage): Unexpected error: java.lang.StackOverflowError
Exception in thread "Thread-0"
Exception: java.lang.StackOverflowError thrown from the UncaughtExceptionHandler in thread "Thread-0"
Process finished with exit code 1
我不知道如何获得有关原因的更多信息,但我想如果正常执行它们时没有问题,那么测试中就没有问题。
我已经修改了这个,但没有这样的选项。此外,IDE 建议通过修改位于/Users/myUser/Library/Application Support/Google/AndroidStudio4.1/studio.vmoptions
(对于 Mac)中的文件 studio.vmoptions 来增加堆,但是当我将它从 -Xmx1024m 增加到 -Xmx2048m 或更多时,我遇到了同样的问题。
编辑:单独运行覆盖率的测试时,它们会成功执行。
解决方案
推荐阅读
- javascript - 我怎样才能让电子用按钮打开一个exe文件
- java - 在进行 Java 字符串比较时 ~ (tilda) 的值是什么?
- python - 遍历 2 个字典,如果值出现在一个字典中,则倒数另一个字典中的 int 值,然后如果 count = 0 则删除键
- compiler-construction - 如何确定所需的别名分析类型?
- javascript - app.get 和 router.get (Express) 的区别
- vue.js - Vue:使用范围为组件的 Vuetify 库?
- python - 对于我的 if-else 语句,应该显示 else,而不是 if。我不知道为什么
- r - 试图用 R 中的 plm 在 stata 中重现 xtreg
- python - 创建给定字符串和给定字典中的所有单词的列表
- python - 用 for in 语句替换列表中的项目(Python)