Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to open debugger port : java.net.ConnectException "Connection refused"

Tags:

I'm using Android Studio v1.0.1 to build an app in macOS Yosemite 10.10. When I try to debug the app, it installs correctly but has the error

Error running [app]: Unable to open debugger port : java.net.ConnectException "Connection refused"

When I run the DDMS, it shows the connected devices and the process. The trouble occurs just when trying to debug in Android Studio.

In other forums, I've found that something could have changed the port of the debugger, but that doesn't solve my issue.

like image 611
Kleiber J. Perez Avatar asked Feb 02 '15 17:02

Kleiber J. Perez


People also ask

How do I check if a debug port is open?

Try opening a command prompt and enter "netstat -a" to see a list of ports that are currently in use on your machine. Then pick a port that's not in use.

How do I enable a debug port?

Right-click the integration server, and click Flow Debug Port > Enable to enable debugging on the selected integration server.

Why debug is not working in Intellij?

To solve this, simply remove the jar of the debugged module from all modules' dependencies in the Project Structure. If you do not know which modules have the debugged module jar as dependencies, you can use some tools (Eg. Sublime Text, bash, ...) to search for the module name which is stored in Intellij *.


Video Answer


1 Answers

Your debug port is probably busy (in use by another process). You can kill all the process associated with the ADB debug port (8601 or higher) using this:

fuser -k 8601/tcp  

UPDATE:

Under OSX, lsof should do the job in substitution of fuser:

lsof -i :8601 
like image 52
bonnyz Avatar answered Sep 21 '22 20:09

bonnyz