ADB Connect Error: Empty Host Name - android

I used to be able to connect to my android phone via adb just fine. Now, however, whenever I try, I get "empty host name." I've researched this question and the only advice I can find is to "change the net.hostname property on your phone" (e.g. thread). However, I know it's not the phone's fault because other computers can connect to it just fine. It's only my computer that can't anymore. (I'm using Windows 8). I've tried shutting down, turning off the wifi (and turning it back on), doing adb disconnect, kill-server, start-server, etc. None of it works. I haven't installed any updates that could be causing this problem. Any thoughts?

Related

error: more than one device/emulator - cant remove unity emulator

Im trying to get debug info through logcat when developing for android. Logcat does not show any info but only an error
error: more than one device/emulator
When i run command
adb devices
i get
List of devices attached
R3CT20DP74P device
emulator-5562 offline
I guess the emulator is preventing my phone from connecting with adb? Im also guessing thats what causing catlog from logging from my phone. Do i remove the emulator -5562 somehow? Ive tried adb kill-server but the emulator reapears.
Ive also tried
adb -s emulator-5562 emu kill
returns:
error: could not connect to TCP port 5562: cannot connect to 127.0.0.1:5562: No connection could be made because the target machine actively refused it. (10061)
Ive tried:
adb.exe -s R3CT20DP74P forward tcp:7201 tcp:7201
which returns
7201
but does nothing else. Emulator is still there.
First of all, there are 2 separate errors that you're getting, and they actually have nothing to do with each other. You'll need to deal with both of them:
error: more than one device/emulator:
you need to run adb kill-server to clear the connected devices, and then restart ADB. It'll auto-connect any devices that are physically connected via USB, but it won't connect any emulators or devices that are connected via wireless debugging
error: could not connect to TCP port: it looks like you're trying to connect via wireless debugging, and it's a bit finicky. It times out after a while, and the device starts rejecting your connection requests. To fix it, you have to physically connect your device to the PC using a USB cable, and as soon as you do that, it should give you a confirmation prompt on the device to allow the USB debugging connection. After you approve that request, you'll need to turn off wireless debugging, and then turn it right back on. It'll generate a new TCP port for you to use, and you will now be able to connect to wireless debugging using that new port

ADB offline issue

I made a program to backup files in android devices. To put it simply, it works in background of Windows like a server and when a defined android device (with its LAN IP) connects to home's WiFi network it looks for specific files in specific folders in device and backups them.
My problem is, for some devices (e.g Samsung Note 4), after a few successful WiFi connections (or a few days later) the device starts to appear offline. To fix this, I need to reset the authorities in device or do the reconnection procedure of my program with USB cable again. I researched the web in-depth but couldn't find a way to make offline devices online automatically.
Most of 'ADB offline' solutions on the web works well, but i need to do this automatically over WiFi within my program.
-ADB kill-server & start-server, not working,
-ADB disconnect & connect, not working too.
Disable your antivirus and then try again or add adb.exe as exception in your antivirus.

Android ADB can't ALWAYS see the phone device

I have read all the relative threads about ADB not recognizing devices. My case though is different: ADB sometimes "sees" my phone (Samsung Galaxy) and other times NOT. No matter how many times I kill and restart the ADB service or I disconnect and reconnect the device from/to the PC. Quite an unstable situation here. You know, it's one of these things that drives you crazy. That's why I resorted to your help.
Has anyone had this exact problem and resolved it once for all?
More info:
The PC has never a problem recognizing the device.
I try with both the standard SDK adb.exe and the Universal ADB driver adb.exe.
Either of the above have no problem recognizing the emulator.
Couple things.
1) it's a dumb suggestion but sometimes its as simple as this. Did you try more than one cable?
2) If yes, then try this. try as many times as you have to get it connected since u said "ALWAYS" so it does work sometimes. When it does work, open terminal or command line and run the following commands.
(make sure device is connected when you do this AND you are on the same wifi network)
adb tcpip 5555
then disconnect your phone and run the following command:
adb connect YOUR_LOCAL_IP
do this many times, this is wireless adb connection and if this works, its something with ADB or your computer and not the phone.
Let me know if it works. I might have more ideas depending on what result you get
============ EDIT ============
I believe it's offline because it says 8080. I just did the same with my phone and I get the following:
Try this: disconnect phone physically (if connected) and all other devices and make sure by doing: adb disconnect.
then, do adb kill-server
then, on your phone, go to Developer Options and uncheck USB debugging.
then, right underneath that options, there is Revoke USB debugging authorizations options. select and revoke all devices
then, check USB debugging
then, back on your computer, run adb start-server
then, try reconnecting with the steps I said before. make sure port is 5555
when you run the adb connect command, make sure to add the port at the end.
example: adb connect 10.0.0.15:5555
Hope this works.

Android adb wireless/WIFI debug Operation timed out

I followed steps in this post and tried to connect to my Motorola X Gen 2 for Wifi debugging, on OS X El Cap.
I connected my phone to the laptop with usb cable,
I killed and started server, the server was started successfully, and then in:
./adb devices
I got
List of devices attached
TA44909GA0 device
Then I did
./adb tcpip 5555
And I tried
./adb connect <IP addr of my phone>:5555
both with usb cable connected and disconnected, none of them worked. Both returned error message saying:
unable to connect to ***.***.***.***:5555: Operation timed out
I cannot figure out what is happening here, I tried the Android Studio plugin ADB WIFI, which returned the same message, operation timed out. I restarted everything, tried connecting with a different cable and all, nothing worked.
Does anyone know what's happening here?
Make sure your computer and the android device are using the same wifi network. I had the same issue and fixed it after changing to the same wifi.
So after a huge number of trials, I think the problem is somehow wifi related, I think this feature does not work well with WPA2 (or any kind of?) Enterprise encryption, because I was using my school Wifi, and it turned out to be okay, up and running, for the hotspot I set up with another laptop.
What solved this for me:
disconnect the phone from USB cable
restart the phone
reconnect the phone by USB cable
(meanwhile):
adb kill-server
adb start-server
Then follow the "standard" procedure.
If you are connected on same network and still can't connect then check your IP twice . Sometimes it get changed.
check your IP = phone settings -> About phone -> Status -> IP address
Try increasing the timeout in Android Device Monitor.
From Android Studio: Tools->Android->Android Device Monitor
In Android Device Monitor:
Window->Preferences, Android->DDMS.
In the DDMS window, increase the "ADB Connection Timeout (ms)". It defaults to 5000ms. If your app is particularly large/takes a long time to load, it may go longer than this timeout, so increasing may fix it.
If you are using Mac OS.
Check by clicking on the wifi icon in the toolbar. If there is any warning.
In my case there was a warning saying the wifi is using WPA protocol and its not secure.
I went to my router settings and changes the protocol to WPA2/WPA3 auto.
After that the warning went away and the wireless debugging started working.

Virtual device running in Genymotion periodically goes offline in ADB

I have an Android device (with Lollipop image, if important) running in Genymotion 2.4 and connect to it via ADB (version 1.0.32) from another developer PC with Eclipse in local network without connectivity problems. All is fine except for periodical drops of ADB connection (other protocols keep working fine), that is ADB loses the device, and when I try to reconnect it says that device is offline. From my experience, this offline status does basically mean that the receiving end (the device) still thinks it's connected and declines new connection. The only method I know to remedy this problem is to restart the device and then ADB connects to it as expected.
If someone is interested, ADB is not running on the remote host machine with Genymotion - otherwise the remove connections from other PCs would be impossible.
The question: how can I refresh "softly" the virtual device to accept new ADB connection without restarting entire device?
P.S. If I leave the "offline" device for its own for some time (quite a long time, for example, for an hour) it seems refreshes its state without external interaction, so ADB is again able to properly connect to and device is reported as "online". But, it makes no sense to wait so long for this to happen. This is just a new piece of information for consideration.
This may not work for you, but has worked for me in the situation where my device simply goes ADB offline. One of the comments on your question mentions that their emulator typically goes offline when their device sleeps. Mine does the same and also goes offline after long periods of inactivity, despite not actually sleeping. Anyway, my fix is plain and simple:
In terminal, navigate to where you have the SDK installed. Then, navigate to the directory platform-tools within your SDK, and issue the following command:
adb kill-server
After that finishes, type this one:
adb devices
That almost always fixes my problem, and I hope it fixes yours as well. Let me know how that works for you.
If you use MacOS Sierra - there is a known bug in it.
28.11.2016 There is no workaround yet except restarting adb which is suggested in #lustig answer.
Google gonna fix it in Android Studio 2.3. Issues to track 82425, 216214
There is no info about will Apple fix it on their side or not.

Categories

Resources