在Android Studio中运行Robolectric测试时如何进行调试? [英] How to debug when running Robolectric tests in Android Studio?

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

问题描述

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


运行package_name时出错:app_name [test]:无法打开调试器
port:java.net.SocketException Socket closed


任何想法?

解决方案>

我发现错误的原因。要使其运行,您需要在编译器 - >Android Studio的Gradle设置中取消选中使用进程内构建选项。




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:

Error running package_name:app_name [test]: Unable to open debugger port : java.net.SocketException "Socket closed"

Any ideas?

解决方案

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测试时如何进行调试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆