How to debug when running Robolectric tests in Android Studio?
10,684
Solution 1
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.
Solution 2
I was getting this error on linux, and the problem was that the another previous process has taken the port and hung. So, the solution is a netstat to locate the process blocking the port, then kill this process, or you can restart the machine.
Author by
Eugene
Updated on June 06, 2022Comments
-
Eugene almost 2 years
I need to run debug while my tests execution in Android Studio + Robolectric. Each time I try to run them by selecting
debug
for thetest
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?
-
StackFlowed over 9 years@HeathBorders can you please post detail how to make this work on Intellij
-
user963601 over 9 yearsI don't remember now. I hope past me would have added more notes or a different answer if there were more steps.
-
Nilzor over 9 yearsThis slows down the build, so I hope Google comes around to fix this in Android Studio. @HeathBorders: IntelliJ IDEA does not have this issue, as it doesn't support In-process build in the first place.
-
parvus about 9 yearsThis does not help me. Running Android Studio 1.1.0
-
Maciek Czarnik almost 9 yearsWhere can I find this setting? Sorry I'm very new to Android Studio, and I don't like Android in general :P
-
Benjamin Burkhart over 7 yearsThis doesn't seem to apply any more in IntelliJ 2016.3.3
-
Ms. Amelia S. Greene about 7 yearsThis setting seems to have disappeared in Android Studio v1.3. Here is a workaround: stackoverflow.com/a/31570957/1434060