本文介绍了在 Android Studio 中运行 Robolectric 测试时如何调试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在 Android Studio + Robolectric 中执行测试时运行调试.每次我尝试通过从 Gradle 任务中为 test 任务选择 debug 来运行它们时,我都会收到错误消息:

I need to run debug while my tests execution in Android Studio + Robolectric.Each time I try to run them by selecting debug for the test task from Gradle tasks I get the error message:

运行 package_name:app_name [test] 时出错:无法打开调试器端口:java.net.SocketException套接字关闭"

有什么想法吗?

推荐答案

我找到了错误的原因.要使其运行,您需要取消选中编译器中的使用进程内构建"选项 -> Android Studio 的 Gradle 设置.

I found the reason of the error. To make it run you need to uncheck the "Use in-process build" option in Compiler -> Gradle settings of Android Studio.

这篇关于在 Android Studio 中运行 Robolectric 测试时如何调试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 01:27