I upgraded to a new pc using Windows 7. Eclipse can't connect to the ADB. Ever. Task Manager shows the ADB port number to be anywhere from 3180 to 5452, never in the range 5555 to 5585 it should be at. Going to the command prompt entering "kill-server" then "start-server" to reset last showed "daemon not running. starting it now on port 5037 * daemon started successfully" but the next command "adb devices" shows nothing attached. The port number changes and DDMS shows the ADB was forcefully closed so there's a connection somewhere.
I tried updating drivers and forcing the port number connection using 'adb port xxxx' but obviously it hasn't worked or I wouldn't be posting here. With my last pc using WinXP I was able to force the port number if needed to make it work but that isn't happening here.
Any suggestions?
Related
Background:
I recently upgraded to an AMD processor and found that the Android device emulator was complaining about not having hardware acceleration. (This is an issue for another question). My old Intel computer worked fine, so I decided to run the emulator on the old Intel PC (emu-pc) and use my new AMD computer (dev-pc) to code.
Problem:
I wasn't able to directly have the emulator expose its ports on the emu-pc to connect to via adb on the dev-pc (again an issue for another question), so I installed the Windows 10 OpenSSH server (Microsoft instructions) and connected to it from my dev-pc, forwarding the proper ADB ports:
ssh {you}#<{remote ip} -L 5554:localhost:5554 -L 5555:localhost:5555
I then tried connecting to the remote emulator via adb:
adb connect localhost
I was met with
$ ./adb devices
List of devices attached
localhost:5555 unauthorized
I've tried a few of the posts stating you should disable and re-enable USB debugging or revoke all the USB debugging authorization or use the "Wipe Data" option in the AVD Manager. None of these worked. I also tried messing with the adbkeys on the emulator under /data/misc/adb/adbkeys but I get permission denied trying to do anything to that file. (I also can't ls it via an adb shell)
Any ideas?
I found something that worked for me. I was able to telnet to the emu-pc via port 5554, where I tried to auth on the Android console. The login message said:
Android Console: type 'auth <auth_token>' to authenticate
Android Console: you can find your <auth_token> in
'C:\Users\exile57\.emulator_console_auth_token'
I found that file and was able to log in. This made me think that the emulator thinks the connection is coming from the emu-pc, yet the keys that I was using were generated on the dev-pc. I found the keys on emu-pc in C:\Users\[your user]\.android as adbkey and adbkey.pub. I copied those to the dev-pc, killed the adb server, disconnected all devices, then tried reconnecting:
$ ./adb disconnect
./adb kill-server
./adb connect localhost
After a bit, I was able to connect and drive the device over adb:
$ ./adb devices
List of devices attached
localhost:5555 device
NOTE I'm not sure this is the whole story, as when testing this out for this answer, I deleted the dev-pc's adbkey and adbkey,pub and was still able to reconnect, so that seems a bit strange. It worked for me, but be aware, I'm not sure the mechanism.
In Android studio, Run menu > Run shows OFFLINE ... for the connected device.
Below is the procedure followed to solve it:
(Read the below note first) Delete the ~/.android/adbkey (or, rename to ~/.android/adbkey2, this is even better incase you want it back for some reason)
Note: I happened to do this step, but it didn't solve the problem, after doing all the below steps it worked, so unsure if this step is required.
Run locate platform-tools/adb
Note: use the path that comes from here in below commands
Kill adb server:
sudo ~/Android/Sdk/platform-tools/adb kill-server
You will get a Allow accept.. message popup on your device. Accept it. This is important, which solves the problem.
Start adb server:
sudo ~/Android/Sdk/platform-tools/adb start-server
In Android studio, do Run menu > Run again
It will show something like Samsung ... (your phone manufacture name).
Also installs the apk on device correctly this time without error.
Hope that helps.
Here is how I did it:
First you need to run the emulator on the host computer. I used Android Studio and I had to close it because I noticed that the adb process kept spawning.
Start port-forwarding using SSH in the development computer.
ssh -L 5554:localhost:5554 -L 5555:localhost:5555 user#emulator-host-ip
copy adbkey and adbkey.pub files found at: C:\Users\[your user]\.android from the host computer to the development computer. this step should get ride of the unauthorized problem
in the development computer kill the adb server and lookup connected devices:
$ ./adb kill-server
$ ./adb devices
List of devices attached
localhost:5555 device
I've recently upgraded to Android SDK Platform-Tools version 28.0.2. Version information:
$ adb version
Android Debug Bridge version 1.0.40
Version 28.0.2-5303910
When using the adb connect command I now get the following error:
$ adb connect 192.168.1.20
missing port in specification: tcp:192.168.1.20
ADB previously connected to devices using TCP port 5555 by default. I am still able to connect to my device by specifying this port number:
$ adb connect 192.168.1.20:5555
connected to 192.168.1.20:5555
However, this is a minor inconvenience to me as I'm used to typing in just the IP address. Is there any way of telling this version of ADB to use TCP port 5555 by default?
Update
This bug has now been fixed as of ADB version 1.0.41, which is part of Platform Tools version 29.0.4. The fix for the bug was committed on 31st July 2019:
Restore default port for adb connect.
The default port of 5555 was removed a while back, but the help text was
never updated, and other contexts still allow a default port.
Bug: https://issuetracker.google.com/128561172
Inputting adb connect 192.168.1.20 without the trailing port number now results in ADB connecting to the target device, restoring previous behaviour.
Old answer
This would appear to be a bug within ADB, introduced in December 2018 or January 2019. I believe this relates to recent changes to this else statement in socket_spec.cpp.
} else {
std::string addr(spec.substr(4));
port_value = -1;
// FIXME: ParseNetAddress rejects port 0. This currently doesn't hurt, because listening
// on an address that isn't 'localhost' is unsupported.
if (!android::base::ParseNetAddress(addr, &hostname_value, &port_value, serial, error)) {
return false;
}
if (port_value == -1) {
*error = "missing port in specification: ";
*error += spec;
return false;
}
}
If a port value is not specified, the variable port_value is initialised at -1 and does not change. This value is not altered by android::base::ParseNetAddress either. If the ParseNetAddress check passes then we will always fall into the error-catching statement immediately afterwards.
I can able to connect my android phone by adding a port number in the postfix place.
For example,
$ adb kill-server
$ adb connect 192.168.1.20:5555
Directly it could not able to connect, it was giving me the above error.
NOTE: Port number is compulsory to apply, maybe your port number is currently different so please find that and then try to connect again.
$ adb kill-server
$ adb connect 192.168.1.20
Just kill the adb server and connect normally. Default port (5555) is restored when server is restarted.
I stumbled upon this thread when I searched for a similar problem I had with the Visual Studio emulator for Android. When you try to drag & drop an *.apk file for installing, it gives you the same error
I fixed it by downloading the latest -working- platform-tools v27.0.1 from google and replacing the content in the android SDK folder (in my case %LOCALAPPDATA%\Android\Sdk).
I know, it's not the best solution, but as long as google didn't release a fixed adb version (still not in v29.02), I can live with it.
There's another workaround, with credit to this unknown person in the Google issue thread. Create a custom alias that automatically adds the default port number to the IP address.
For Linux & MacOS, in ~/.bashrc or ~/.bash_aliases:
function adbc() {
adb connect $1:5555
}
Then connect using command
$ adbc 192.168.1.20
For Windows users:
Put this in adbc.bat anywhere in your PATH
#echo off
adb connect %1:5555
Then connect using command
> adbc 192.168.1.20
Just flagged this on an AndroidThings device,
had to swap
adb connect Android.local
with
adb connect Android.local:5555
Setting the port for the Android device will solve the problem.
Here is how:
Connect the Android device with USB to your computer (Linux, MacOs or whatever) with adb installed.
Execute adb tcpip <port_number>. This will set the device in TCP mode with port , although the device may not be currently using the Ethernet or WiFi. This will make the port_value not equals -1 or undefined.
disconnect the Android device from your computer through USB.
adb connect <IP address>:<port number>
This should connect the device. The device should show up in the result of adb devices.
It worked for me when I "adb over Ethernet" and "adb over wifi" with my Pixel 3 XL.
This question already has answers here:
Eclipse error "ADB server didn't ACK, failed to start daemon"
(23 answers)
Adb won't start
(21 answers)
Closed 6 years ago.
I am trying to install my project on 5 AVD's at the same time, but I constantly get this error, I am executing it on Windows 8.1
"* daemon not running. starting it now on port 5037 *
ADB server didn't ACK
* failed to start daemon *
error: cannot connect to daemon"
I have tried reading all possible posts on stackoverflow concerning this error, and all of them just mention that try to kill the adb process and restart eclipse and then all will be fine. I have tried the method mentioned in the posts and along with that I have also turned off my security and firewall, so that there is no obstruction on the port 5037. Somebody please help me as I need to execute my project and I am not able to do so :(. For your reference I can provide the output of the following command "netstat -ano | findstr "5037""
TCP 127.0.0.1:5037 0.0.0.0:0 LISTENING 7144
TCP 127.0.0.1:5037 127.0.0.1:57410 ESTABLISHED 7144
TCP 127.0.0.1:5037 127.0.0.1:57411 ESTABLISHED 7144
TCP 127.0.0.1:5037 127.0.0.1:57414 ESTABLISHED 7144
TCP 127.0.0.1:5037 127.0.0.1:57415 ESTABLISHED 7144
...
Somebody please suggest a workaround this problem, what might be the cause of this. Also you can take a look at the following image to infer what might be happening.
Try the following:
Close Eclipse.
Restart your phone.
End adb.exe process in Task Manager (Windows). In Mac, force close in Activity Monitor.
Issue kill and start command in <sdk_folder>\platform-tools\
C:\sdk\platform-tools>adb kill-server
C:\sdk\platform-tools>adb start-server
If it says something like 'started successfully', you are good.
For anyone using OSX (I'm aware OP isn't):
What worked for me in the end was removing the android settings folder in the home directory.
rm -Rf ~/.android
For me it didn't work , it was related to a path problem happened after android studio 2.0 preview 1, I needed to update genymotion and virtual box, and apparently they tried to use same port for adb.
Solution is explained here link!
Basically you just need to:
1) open genymotion settings
2) specify sdk path for the adb manually
3) adb kill-server
4) adb start-server
Similar questions are
"The connection to adb is down, and a severe error has occured."
The connection to adb is down, and a severe error has occured.You must restart adb and Eclipse.Please ensure that adb is correctly located
ECLIPSE-The connection to adb is down, and a severe error has occured
First close IDE.
In my case I killed adb via Task Manager(adb kill-server did not work)
then adb start-server
daemon not running. starting it now on port 5037 *
daemon started successfully *
If you see "started successfully" than it is solved, now start IDE.
On my Mac, I wrote this code in my Terminal:
xxx-MacBook-Pro:~ xxx$ cd
/Users/xxx/Documents/0_Software/adt20140702/sdk/platform-tools/
xxx-MacBook-Pro:platform-tools xxx$ ./adb kill-server
xxx-MacBook-Pro:platform-tools xxx$ ./adb start-server
daemon not running. starting it now on port 5037 *
daemon started successfully *
xxx-MacBook-Pro:platform-tools tuananh$
Hope this help.
if you are using any mobile suit like mobogenie or something that might also will make this issue. try killing that too from the task manager.
Note : i faced the same issue, tried the above solution. That didn't work, finally found out this solution.May useful for someone else!..
On my end, I used Resource Monitor to see which application was still listening to port 5037 after all the Eclipse and adb restart were unsuccessful for me.
Start > All Programs > Accessories > System Tools >
Resource Monitor > Network > Listening Ports
This eventually showed that java.exe was listening to port 5037, hence, preventing adb from doing so. I killed java.exe, immediately start adb (with adb start-server) and received a confirmation that adb was able to start:
android-sdks\platform-tools>adb start-server
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
I've got a kind of botch for the old ADB server didn't ACK * failed to start daemon * issue which might help, though i haven't seen anyone else with my problem so maybe not. Anyway...
I changed the default install location for my HTC sensation to 2 (SD card), but when trying to revert back to 0 (internal) i was getting this error. Looking in task manager showed there were 2 instances of adb.exe running, one of which kept stopping and starting and was impossible to kill, the other could be killed but then a new instance would start almost immediately.
The only way i could get adb to start successfully was to get my command ready in the command window, go to task manager to end the adb.exe, then when the window came up saying 'are you sure you want to kill adb.exe' dragged that over the command window, clicked OK then immediately pressed Enter to run the command. It seems that the short window between adb.exe being killed and restarting itself is sufficient to run a command, though if you try to do something else it won't work and you have to repeat this process each time you want to run a command.
PITA but it's the only way an uneducated numpty like myself could get round it - hopefully it'll help someone...
i have solve this problem several times using the same steps :
1- Close Eclipse.
2- Restart your phone.
3- End adb.exe process in Task Manager (Windows). In Mac, force close in Activity Monitor.
4- Issue kill and start command in \platform-tools\
C:\sdk\platform-tools>adb kill-server
C:\sdk\platform-tools>adb start-server
5- If it says something like 'started successfully', you are good.
but now it's doesn't work cause i have an anti-virus called "Baidu", this program have run "Baidu ADB server", finally i turn this process off and retry above steps it's work properly.
I need to know, how I get console port to which android emulator is connected programmatically. I am using library com.android.ddmlib.
To be more specific: Let's say that I have already started some emulator and when I execute some program, it checks if there is some emulator on some port (e.g. 5554). If it is, the output is true, otherwise false.
I can access all devices (IDevice) from android debug bridge, but I am not able to realize, if that particular device is bound to some specific port.
All I see is the output from adb devices -l, but it writes only "emulator-5554". Is it the only way how to realize the port?
The command adb start-server shows the message,
* daemon not running. starting it now on port xxxx *
"xxxx" is the port number which is being used by adb.
I am currently investigating a problem I have where for some reason eclipse plugin/adb loses connection to my phone and gives me the message:
[2011-03-05 22:53:40 - projectOne] Attempting to connect debugger to 'com.testbed.input' on port 8633
[2011-03-05 23:04:02 - projectOne] ------------------------------
[2011-03-05 22:40:42 - projectOne] Android Launch!
[2011-03-05 22:40:42 - projectOne] adb is running normally.
[2011-03-05 22:40:42 - projectOne] Performing com.testbed.input.MainActivity activity launch
[2011-03-05 22:40:42 - projectOne] Automatic Target Mode: Unable to detect device compatibility. Please select a target device.
And on the device monitor log I see this:
[2011-03-05 23:10:13 - Logcat]device (HT971L900496) request rejected: device offline
java.io.IOException: device (HT971L900496) request rejected: device offline
I cant figure out what it is, it just works flawless one day and next I get this. I hope someone with a more expert knowledge of the tool chain can help as its really slowing me down so I am determined to get to the bottom of this.
Many thanks
I can confirm that intermittent "adb devices" problems can be put down to using the wrong USB port.
I think it has something to do with the power output of the various ports (i.e. not enough power).
I had intermittent problems with USB connection to Android Note II (Samsung Note 2 clone) for a week.
I didn't believe all the Google articles saying to use a different USB socket,
because I didn't think I had any others than the two on the front right of my Lenovo Thinkpad L420.
Guess what, after finally checking the back carefully, there it is, a single USB socket on the very end.
After plugging into that socket, "adb devices" always lists the device.
Hooray!
For the benefit of other (Ubuntu) users, I am showing my tips for getting "adb devices" to work.
Figure out how the device is recognized by Ubuntu Linux.
Plug in the device, do "lsusb" then use the first hex number of the device ("0bb4" here)
as the "idVendor" attribute in a file called, "/etc/udev/rules.d/99-android.rules",
with the following, one-line contents:
SUBSYSTEM=="usb",ATTR{idVendor}=="0bb4",MODE="0666",GROUP="plugdev"
** Do not put spaces after the commas in this line.
Then, "sudo service udev restart".
Don't forget to add yourself to the "plugdev" group: "sudo usermod -aG plugdev".
Execute: adb kill-server; adb start-server; adb devices.
The adb server listens on port 127.0.0.1:5037 (netstat -anp|grep LISTEN).
So if any adb command is hanging, check that you can "ping 127.0.0.1".
If localhost ping fails, check firewalls and also check "sudo iptables-save",
looking for a missing "allow" rule for localhost ("lo").
Also, "ifconfig -a" will expose whether localhost interface is up (Google "ifup").
I hope someone else finds this information useful.
I don't know why it happens but I have found a quick remedy - first kill any adb process.
Then start the adb again with the command 'adb start-server'.
This then allows me to connect to the phone again
Another nugget of information for others that I found:
http://groups.google.com/group/android-developers/browse_thread/thread/5fb922c2166eab68
I had the usb plugged into the front of my computer and I was experiancing problems - after pluging it at the back direct to the usb controller and not a hub it has become much more reliable.
I had the same problem. Here is my solution: you have to connect the USB cable from your PC to your phone while pressing the power button of you phone.