JDev
JDev

Reputation: 181

could not connect to tcp:5037: cannot connect to 127.0.0.1:5037: No connection could be made because the target machine actively refused it. (10061)

Hi I am new to android I am not able to run adb.exe it gives me below error:

==>adb start-server
adb I  6108  5748 adb.cpp:219] Android Debug Bridge version 1.0.32
adb I  6108  5748 adb.cpp:219] Revision 09a0d98bebce-android
adb I  6108  5748 adb.cpp:219]
adb I  6108  5748 adb_client.cpp:126] _adb_connect: host:version
adb I  6108  5748 sysdeps_win32.cpp:742] could not connect to tcp:5037: cannot connect to 127.0.0.1:5037: No connection could be made because the target machine actively refused it. (10061)
adb I  6108  5748 adb_client.cpp:175] adb_connect: service host:start-server
* daemon not running. starting it now on port 5037 *
Cannot open 'nul': The system cannot find the file specified. (2)
* failed to start daemon *
error: cannot connect to daemon

What does this error exactly mean..?

Cannot open 'nul': The system cannot find the file specified. (2)  

What is this error..?

Upvotes: 17

Views: 66352

Answers (9)

If your adb devices just hangs. This means that someone has stolen port 5037.

Check Traccar Server occupies a range from 5000 to 6000 ports for GPS devices!

Upvotes: 0

user1874594
user1874594

Reputation: 2493

In my case the version of adb was culprit. Look at the -nodaemon option also in the below use case which causes adb.exe stopped working error. ( Incidentally I have another AB Partition 5G phone where the latest version tools work but they wont work on an earlier android 12 phone ? ..dunno.. conjecturing )

    Turn on debugging on your client PC . See in code 
    Try out adb.exe nodaemon server did not work for me 
    Downgrade to a more compatible version

    # set ADB_TRACE=ALL
    # where adb
    C:\Users\HOME\Downloads\scrcpy-win64-v1.21\adb.exe
    C:\Users\HOME\AppData\Local\Android\sdk\platform-tools\adb.exe
    
    HOME@HOME-PC C:\Users\HOME\Downloads\scrcpy-win64-v1.21
    # C:\Users\HOME\AppData\Local\Android\sdk\platform-tools\adb.exe --version
    06-15 20:07:52.788  4536  4368 E adb.exe : adb_trace.cpp:137 Unknown trace flag: ALL
    Android Debug Bridge version 1.0.41
    Version 35.0.1-11580240
    Installed as C:\Users\HOME\AppData\Local\Android\sdk\platform-tools\adb.exe
    Running on Windows 6.1.7601
    # adb --version 
    adb E 06-15 20:07:08  1892  4724 adb_trace.cpp:137] Unknown trace flag: ALL
    Android Debug Bridge version 1.0.41
    Version 34.0.3-10161052 ## <--- this one worked ! 
    Installed as C:\Users\HOME\Downloads\scrcpy-win64-v1.21\adb.exe
    Running on Windows 6.1.7601
HOME@HOME-PC C:\Users\HOME\Downloads\platform-tools_r34.0.5-windows
# adb.exe nodaemon server
06-15 20:02:15.073   980  3968 E adb.exe : adb_trace.cpp:137 Unknown trace flag: ALL
06-15 20:02:15.089   980  3968 I adb.exe : auth.cpp:416 adb_auth_init...
06-15 20:02:15.105   980  3968 I adb.exe : auth.cpp:220 User key 'C:\Users\HOME\.android\adbkey' does not exist...
06-15 20:02:15.105   980  3968 I adb.exe : auth.cpp:64 generate_key(C:\Users\HOME\.android\adbkey)..

Upvotes: 0

make sure that your real device is on developer mode. I am using Poco M2 Pro and I had enabled it before around 15 day. But today it suddenly turned off developer mode.

Upvotes: 0

Sithara Rao
Sithara Rao

Reputation: 1

I had faced the same issue and it was because of the antivirus that was not not allowing to connect with my device. So, I deleted the adb.exe from platform-tools and pasted it again. [Please store the adb.exe before deleting]

After doing this, I got a pop-up from my antivirus software asking if it can allow devices to connect. On clicking OK, I got the authentication key from the device. On checking it, I was able to connect successfully.

Upvotes: 0

Donghua Liu
Donghua Liu

Reputation: 2196

In my computer, it is releated to Hyper-V, I have to completely disabled it. Then the ports like 5037,5055,8080 and so on are avaliable.

See more on https://petri.com/how-to-disable-hyper-v-completely-in-windows-10, https://www.poweronplatforms.com/enable-disable-hyper-v-windows-10-8/.

DO NOT FORGET bcdedit /set hypervisorlaunchtype off!!!

Upvotes: 0

Ajit
Ajit

Reputation: 339

Check this answer which helped me. The issue might be with the latest unstable version of platform-tools.

adb cannot connect to daemon at tcp:5037

Upvotes: 0

K. Robert
K. Robert

Reputation: 15

adb.exe might be corrupted , try to replace these files

ADB.exe
AdbWinApi.dll
AdbWinUsbApi.dll

from the latest SDK Platform-Tools for Windows

Upvotes: -3

java acm
java acm

Reputation: 1050

make sure you have installing your device driver and adb service and is activated USB debugging in android device -> setting -> developer options and must be could to see your device when you connected by USB port ( by this command : adb devices)

so when you connected by USB follow this Commands :

1-stay connect via USB
2-connect to your WIFI network (computer and mobile device both)
3-ping DeviceIP (must be have ping to your device)
4- adb kill-server
5-adb usb
6-adb tcpip 5556
7-adb connect "yourDeviceIP:5556"
8-adb devices (must be see two device names , one of them is by deviceIP:5556)
9-unplug USB cable

then it's Done! and you could to test your app

Upvotes: 26

rupesh jain
rupesh jain

Reputation: 3430

it seems your adb is listening in tcpip mode for connecting over wifi..kill the server using adb kill-server..start it again using adb usb

Else also try l-> Go to task manager and kill adb process. ..

Upvotes: -1

Related Questions