18
votes

When I try run my Android application I get this exception:

Error while waiting for device: java.lang.RuntimeException: Unable to create Debug Bridge: Unable to start adb server: error: could not install smartsocket listener: cannot bind to 127.0.0.1:5037: An attempt was made to access a socket in a way forbidden by its access permissions. (10013) could not read ok from ADB Server * failed to start daemon * error: cannot connect to daemon 'C:\Users\XXX\AppData\Local\Android\Sdk\platform-tools\adb.exe,start-server' failed -- run manually if necessary

So I try do it manualy with these commands:

adb kill-server

  • response: * server not running *

adb start-server

  • response was next exception:

*daemon not running. starting it now on port 5037 * error: could not install smartsocket listener: cannot bind to 127.0.0.1:5037: An attempt was made to access a socket in a way forbidden by its access permissions. (10013) could not read ok from ADB Server

*failed to start daemon * error: cannot connect to daemon

I looking for adb process in my task manager but not running. Any ideas? Thanks.

8

8 Answers

11
votes

If you have the situation where this keeps happening and killing and restarting still doesn't work it may be a problem with your adb installation. I had to reinstall adb to resolve this problem:

  1. Reboot to ensure no instances of adb is running
  2. Launch SDK Manager in Android Studio: Tools->Android->SDK Manager
  3. Select the SDK Tools tab
  4. Deselect Android SDK Platform-Tools item
  5. Hit Apply
  6. Check the on screen logs to make sure the un-installation succeeded and that the SDK/platform-tools folder is empty.

This should completely remove adb from your SDK.

  1. Now re-select the Android SDK Platform-Tools item
  2. Hit apply
  3. Check the on screen logs that installation was successful.

I suspect in my case an update of the platform tools had failed perhaps because it failed to kill a running adb.exe and only a partial update was applied resulting in an unstable adb installation.

16
votes

Open command prompt and enter following command

netstat -ano | findstr :5037

This will show procees id

TCP 127.0.0.1:5037 0.0.0.0:0 LISTENING 832

832 is procees id

Now run command

tasklist | findstr processID (e.g tasklist | findstr 832)

It will show process name like bash.exe

just go to task manager and end the task bash.exe and use following command to start adb

adb start-server

voillllaaaaaaa........

1
votes

I solved this for myself by simply closing the shell I'd been running adb commands in and starting a new one, inspired by Vinayak Mestri's answer.

1
votes

I fixed it by adding the ADB to path:

sudo ln -s ~/Android/Sdk/platform-tools/adb /bin/adb

And then killing the ADB server adb kill-server and starting the server again adb start-server.

Observation: I tried to kill java, tried to find the port where it was running using HTOP and Kill, aside from restarting everything but it was a pain in the ass

0
votes

In my case, the culprit is Visual Studio 2017. I found out this with the help of Vinayak's answer. I just closed Visual Studio 2017, then ADB started working.

0
votes

Restarting adb server uns an External terminal (CMD) did the job for me:

Android-SDK/platform-tools/adb.exe kill-server
Android-SDK/platform-tools/adb.exe start-server
0
votes

you just let "command prompt" to run as administrator. so, you can run the command "nox_adb.exe connect 127.0.0.1:62001" pic as follow: https://i.stack.imgur.com/fAmXz.png

0
votes

thanks mestri
List the process id using 5037 port

netstat -ano | findstr :5037

TCP 127.0.0.1:39187 127.0.0.1:5037 ESTABLISHED 5400 TCP 127.0.0.1:39188 127.0.0.1:5037 ESTABLISHED 5400 TCP 127.0.0.1:39798 127.0.0.1:5037 ESTABLISHED 5400 TCP 127.0.0.1:39902 127.0.0.1:5037 ESTABLISHED 7296 TCP 127.0.0.1:40148 127.0.0.1:5037 ESTABLISHED 5400 here 5400,7296 is the pid number

taskkill /pid pidnumber

THEN \n

adb connect localhost:62001

adb server version (41) doesn't match this client (36); killing... * daemon started successfully * connected to localhost:62001