error: cannot connect to daemon - android

Almost a month ago I directly debugged application on my device with Processing (PDE) but today when I'm trying to deploy the application it doesn't work (keep in mind that I have updated SDK) it keeps getting an error as follows:
error: cannot connect to daemon
nope: adb devices
status: 1
1065ms
stdout:
* daemon not running. starting it now *
stderr:
CreateProcess failure, error 2
* failed to start daemon *
Even if I run any of the command like adb devices or adb shell I get an error
C:\Users\Hassan>adb devices
* daemon not running. starting it now *
CreateProcess failure, error 2
* failed to start daemon *
error: cannot connect to daemon
I looked on several places and almost everyone said that kill the adb.exe process from task manager but any of that didn't work, I have also disabled the antivirus in case if that was messing, and also allowed the port 5037 in my firewall. what else can i try ?

Open the terminal and run following command
adb kill-server and - adb start-server
Now run adb devices to see the list of devices
I faced this problem while accessing the device in Appium Studio

I had a similar problem - where the error that I was getting was:
\platforms\android\cordova\node_modules\q\q.js:126
throw e;
^
Error executing "adb devices": ** daemon still not running
error: cannot connect to daemon
ERROR running one or more of the platforms: Error: \platforms\android\
cordova\run.bat: Command failed with exit code 8
It seems adb runs on port 5037 and when I checked somhow mozilla firefox was holding on to these ports
netstat -ao 5039
so killing mozilla firefox and running the command:
cordova run android
atleast I dont get this exception anymore

running skipsoft's unified android toolkit fixed this for me
all i did was launch it, select model, select build and finally the device asked usb debugging permission. from there on adb worked

Related

svchost.exe listening on port 5037, stops adb.exe from working

I've been troubleshooting this for hours and I'm so lost.
My Android Studio (Windows) has stopped being able to find devices, which I assumed was some kind of problem with adb. I navigated to the platform-tools folder and tried to run adb from there:
C:\Users\LeonardoPetrucci\AppData\Local\Android\platform-tools>adb devices
adb.exe: failed to check server version: protocol fault (couldn't read status): No error
To fix this, I tried every solution I could find:
Restarting
Stopping adb.exe from task manager
Reinstalling platform tools and Android Studio
None of this worked. So I went to check if there was something using port 5037 (the default Android Studio port):
C:\Users\LeonardoPetrucci\AppData\Local\Android\platform-tools>netstat -aon|findstr "5037"
TCP 0.0.0.0:5037 0.0.0.0:0 LISTENING 16420
C:\Users\LeonardoPetrucci\AppData\Local\Android\platform-tools>tasklist|findstr "16420"
svchost.exe 16420 Services 0 13,744 K
If I then go into Task Manager and stop process 16420 and try to run adb again:
C:\Users\LeonardoPetrucci\AppData\Local\Android\platform-tools>adb devices
* daemon not running; starting now at tcp:5037
* daemon started successfully
List of devices attached
The problem here is that svchost.exe will randomly start up again and take over the port and if I restart, I need to do this whole process again.
Any idea why this would be happening?

Unable to build in Android in vscode

Checking build Searching for devices... Launch failed: ADBSocket Socket connect failed. connect ECONNREFUSED 127.0.0.1:5037. Ensure any instances of Android Studio are closed.
I uninstalled Android studio. Even I checked and port 5037 is free.
I have the same error. I fixed the issue with the following:
On terminal: Run command adb devices
*It showed output like this:
daemon not running. starting it now on port 5037 *
daemon started successfully
List of devices attached 9e0a8524 unauthorized
[1]: https://i.stack.imgur.com/MXtY7.png
Checking adb devices launched a pop up screen on my mobile to allow access. I clicked Allow(Ok) and that's it!
Hope it helps!

Android Studio error: cannot connect to daemon

I've been using AS for months, but since two days I get an error when I try to run my app:
Unable to run 'adb': null
'C:\Users\lapof\AppData\Local\Android\Sdk\platform-tools\adb.exe start-server' failed -- run manually if necessary
* daemon not running; starting now at tcp:5037
could not read ok from ADB Server
* failed to start daemon
error: cannot connect to daemon
I've read about a lot of people having this problem, but the solutions provided don't work for me. I read these questions in particular:
Daemon not running. Starting it now on port 5037
Android ADB - Daemon still not running
How to resolve the "ADB server didn't ACK" error?
Eclipse error "ADB server didn't ACK, failed to start daemon"
Adb won't start
How to resolve the "ADB server didn't ACK" error?
Daemon not running. starting it now on port 5037 * Cannot open 'nul': The system cannot find the file specified
A lot of answers to these questions say to close adb.exe from task manager, the problem is that adb.exe is not running and if I try to restart it by typing .\adb start-server on a PowerShell window I get the same error.
I also try to restart my PC but it didn't work.
On the Android device I'm trying to connect to (Samsung Galaxy S8) I enabled USB debugging. I even tried to eliminate all the authorized devices, but nothing worked.
I checked if the 5037 port was used by other processes, but it is used by adb.exe (and the firewall state on that port is allowed and not limited). By the way, as I said, in the task manager adb.exe is not present.
Last I tried to follow the instructions provided in the last question I linked (basically I re-downloaded adb.exe).
Initially I ran .\adb start-server and this strange error occurs:
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
** daemon still not running
error: cannot connect to daemon
and then when I try to run my app on Android Studio it occurs this new error when it tries to start adb:
Unable to run 'adb': null
'C:\Users\lapof\AppData\Local\Android\Sdk\platform-tools\adb.exe start-server' failed -- run manually if necessary
ADB server didn't ACK
* failed to start daemon *
and then if I try to .\adb kill-server and then .\adb start-server or .\adb devices or .\adb usb the same error occurs again.
Moreover when I connect my device now it asks me to authorize my PC to connect.
I don't know if this can help, but lately I deactivated a lot of Windows services (but I don't think I deactivated something related to Android Studio).
Details
PC: Compaq
PC OS: Windows 10 Home
Device: Samsung Galaxy S8 (Exynos)
Device OS: Android 8.0
AS version: 3.0.1
The solution which worked for me -
Open Command Prompt as administrator and type
adb start-server
That's it
I had same problem a moment ago. I solved it:
Run CMD as Administrator
Enter adb devices to CMD.
The output for me is :
C:\WINDOWS\system32>adb devices
List of devices attached
* daemon not running; starting now at tcp:5037
* daemon started successfully
P9BCS87ABS9SCD5 device
Usually that's caused by the WinNAT service, restarting which solves the issue.
Just open the Command Prompt or PowerShell as Administrator, and type the following commands there:
net stop winnat
net start winnat
And wait a bit for the Android Studio to reconnect to the ADB.
P.S. If it doesn't reconnect, just type the following commands to restart the ADB:
adb kill-server
adb start-server
I solved the problem on my own.
Out of frustration I opened Control Panel > System and security > Windows defender firewall > Allowed applications and I added adb.exe (both private and public networks).
I came back to Android Studio, ran the app and magically it managed to initialize ADB and my phone connected via USB was there.
I don't really know why this worked, since when I checked in Start > All Programs > Accessories > System Tools > Resource Monitor > Network > Listening Port it said that on port 5037 the firewall was allowed.
Moreover I don't know why up to a week ago all worked fine and now I had to do this process to make it work.
If someone more experienced manages to explain this behaviour better I'll update this answer (or accepts his as best answer)
Run CMD or PowerShell as administrator
Then run the following commands:
net stop winnat
In correct folder run:
adb start-server
net stop winnat
Below solution solved my problem:
Go to your task manager
see if adb is running
right click & end the task
Go to command prompt
run adb devices
it will work fine
For my situation
The latest platform is version 30.0.3. I also have the same problem as this:
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
My solving:
Step 1: downloading platform-tool version 28.0.1: https://developer.android.com/studio/releases/platform-tools#2801_september_2018
Step 2: remove platform-tool: go to SDK Manager -> SDK tools
Uncheck "Android SDK Platform - Tool"
Click Apply
Step 3: Going to folder android -> SDK and pass new platform-tool
Step 4: ADB devices.
Then It's working for me.
SDK Manager -> SDK tools
Uncheck "Android SDK Platform - Tool"
Click Apply
After using Android Studio and Emulator without any problems, suddenly it stop to connect to the Emulator, even adb server was running (killing and starting), firewalls raised for all the programs (adb.exe, qemu-system-x86_64.exe, studio64.exe, etc), port 5037 freed, uninstalled and installed again the programs, even the whole Android Studio from scratch. I got verything running OK, but no connection between AS and Emulator.
The solution to my problem was to run Android Studio AS ADMINISTRATOR, it seems that when I updated the program to 3.5.2 somehow the status changed, causing me the problem.
What worked for me in all adb unresolved cases:
adb kill-server
or
adb disconnect
I would just try them both and one will do the trick.
I had this issue several times. It seems if when system is starting, device is connected by USB cable, daemon will connect correctly and no problem will occur. Of course I want a better solution, because it is very hard for me to shut down and start again every time.
Had same issue after upgrading to Android Studio Bumblebee | 2021.1.1
To solve it, go to Settings -> Build, Excecution, Deployment -> Debugger
Then uncheck the option Enable adb mDNS for wierless debugger
I had the same error.
Error on android studio
i use easytether, which was causing the error when is connected.
http://www.mobile-stream.com/easytether/android_faq.html#adbmacosx
After u disconnect it, everything should work fine.

Unable to run Ionic app

I am unable to run my Ionic app in --livereload mode. It gives me an error as:
Error: C:\softwares\android-sdks\platform-tools\adb.exe: Command failed with exit code 1 Error output:
error: could not install *smartsocket* listener: cannot bind to 127.0.0.1:5037: Only one usage of each socket address (protocol/network address/port) is normally permitted. (10048)
could not read ok from ADB Server
* failed to start daemon *
error: cannot connect to daemon
I started task manager and found 3 adb server are running.I tried to kill them but unable to do that. Please help.
I had same problem while running application with genymotion. I gave the custom path of my sdk in adb settings in configuration of genymotion. And it worked for me.
Also same problem occurs if there is duplication of sdk paths.So you should also check your environment variables for that.

ECLIPSE-The connection to adb is down, and a severe error has occured

I've spent day trying to launch any Android program. it gives me the same error:
"The connection to adb is down, and a severe error has occured".
I'm running Eclipse Galileo,on a Windows7 machine.
I've used all the tricks I can find on the web: the command line "adb kill-server", the DDMS "reset ADB", I started the emulator both before and after Eclipse, and searched for ports being used by other programs.
when starting server getting same
* daemon not running. starting it now on port 5037 *
ADB server didn't ACK
* failed to start daemon *
try to end process of adb.exe from task manager ==> processes
then restart the eclipse
I've been encountering this error for how many times, and so I discovered some way of solving this. All I did is turn off my PC and also my phone (Pull out my phone battery and SD card). And first thing to do after turning on my PC go to CMD (Command Line) and type ..
adb devices
.. and see if its working already you could see this.
daemon not running. starting it now on port 5037 *
daemon started successfully *
Then you could run your Eclipse and try to run your Application.
*thats what i've been doing to solve that
*hope it help you too guys
The issue might be with the eclipse edition and the emulator.
For immediate workaround,
try different edition of eclipse and import the same project.
try other emulators such as : https://www.manymo.com/
http://www.genymotion.com/

Categories

Resources