11

I have a problem with adb.exe of Android Studio 3.4.

When I run the emulator, I get this error:

Emulator: emulator: ERROR: AdbHostServer.cpp:93: Unable to connect to adb daemon on port: 5037

I opened a terminal with the rute of the adb.exe: C:\Users\Christian\AppData\Local\Android\Sdk\platform-tools

And here I tried with adb kill-server and then adb start-server and I get this:

*daemon not running; starting now at tcp:5037
*daemon started successfully

When i run again the same error appears, i get this in terminal with the command adb devices:

List of devices attached
emulator-5554   offline

I emulate Nexus 5X API 28 with System Image: Pie 28 x86 Android 9.0.

I download the last version of abd.exe in for Windows

I also reinstalled the Android Studio and the emulator, but the error still appears.

How can I solve that?

Bilal Abdeen
  • 1,627
  • 1
  • 19
  • 41
Christian_bvb09
  • 119
  • 1
  • 1
  • 4
  • Anyone can help me? – Christian_bvb09 May 20 '19 at 11:19
  • 1
    Possible duplicate of [ADB error: cannot connect to daemon](https://stackoverflow.com/questions/7327147/adb-error-cannot-connect-to-daemon) – Suban Dhyako May 21 '19 at 06:03
  • Same issue on my pc today after updating Android SDK Platform-Tools to 29.0.5. Flutter and Dart are updated to the latest as well. Also re-installed Android Studio and Emulator. Looking for a solution. – VipiN Negi Nov 21 '19 at 04:54
  • Check out [my answer on this question](https://stackoverflow.com/questions/62000072/android-emulator-errors-sockettcploopbackclientfor-and-adbhostserver-cpp/63350801#63350801). Hope it helps. – Karthikeyan S Aug 11 '20 at 02:56

8 Answers8

6

You need to first run adb start-server and then run emulator -avd <avd_name>

Uddhav P. Gautam
  • 7,362
  • 3
  • 47
  • 64
2

If you have any port utilizing software like Xampp, Vmware workstation, or virtual box they normally utilize the port through which the Android Studio can access the devices. Therefore,

  1. On your Android Studio interface click on Assistant
  2. It will show you Troubleshoot your connection
  3. click on next until you see Restart ADB Server
  4. do that until it restarts.
JJD
  • 50,076
  • 60
  • 203
  • 339
kis Aar
  • 21
  • 2
2

I had this happen with the following Event Log entry:

Emulator: emulator: ERROR: AdbHostServer.cpp:102: Unable to connect to adb daemon on port: 5037

So I opened command prompt as administrator and ran netstat -a -b >c:\connections.txt and found the following:

 [Amazon Music Helper.exe]
  TCP    127.0.0.1:5037         jbiss-PC:0             LISTENING
 [adb.exe]
  TCP    127.0.0.1:5037         jbiss-PC:54858         ESTABLISHED
.
.
.
[ss_conn_service.exe]
  TCP    127.0.0.1:51146        jbiss-PC:5037          CLOSE_WAIT
.
.
.
 [adb.exe]
  TCP    127.0.0.1:54858        jbiss-PC:5037          ESTABLISHED

So I shut down Amazon Music Helper, shut down and restarted Android Studio and then launched the emulator. It works now. I'm not sure why I started having this problem today, I assume that Amazon Music Helper was involved previously and the status indicated ESTABLISHED for adb.exe, but I did, and this process cleared it up for now at least.

Jeff
  • 431
  • 4
  • 16
  • On ubuntu, you can get a similar table of network connections with `netstat -r`. If you don't have `netstat`, you can install it with `sudo apt install net-tools`. – Olivia Stork Mar 04 '20 at 15:59
0

I had this with flutter. I updated Flutter and Dart to latest version and it resolved.

Abhi R
  • 102
  • 3
0

Close emulator and then Cold Boot that virtual device. And then try again. Here is the link to catchup how to Cold Boot emulator.

Wimukthi Rajapaksha
  • 961
  • 1
  • 11
  • 23
0
  1. Check JAVA_HOME, NODE_HOME and ANDROID_HOME paths in environment variables. If they are not available, set them.

  2. Cold Boot your emulator.

  3. Kill appium server session if it is running. Then re-run the appium server

  4. Run your program through IDE

kamiha
  • 666
  • 1
  • 12
  • 29
0

https://developer.android.com/studio/run/emulator-acceleration.html

I did add this AMD VM installation. Some how I feel that its working how. But few errors still exists. Few Port error has gone.

This error still there while the port access error has vanished.

Emulator: socketTcpLoopbackClientFor: error: fd 60640 above FD_SETSIZE (32768)

Surprise thing is that the same was working in Similar Laptop HP with Ryzon processor few days back. My old laptop crashed and its a new one. Different between the LT is just 8/16 GB ram. Older LT has McAfee while this has Windows defender. I added the adb.exe process in the Exclution list in Windows Defender now.

Arindam
  • 675
  • 8
  • 15
0

I had this with react native. This worked for me. 1 - Open Android Studio 2 - Click AVD Manager 3 - Click On Icon right to the emulator(that you want to run) 4 - Click cold boot

once emulator restart run your app it will works.

Shakeel Haider
  • 107
  • 1
  • 5