16
votes

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?

6
make sure that AP isolation is off on your wifi router - Alex P.
I don't think that's the problem, it worked once, just once, the day before, and the next day it went back to "operation timed out". (And I am using my school wifi, so probably the setting didn't change) - TPWang
Any solution to this? - shiladitya
Not net. Restarting ./adb and phone and wait for a couple of hours would get it to work for a while. I'm suspecting it's hardware problem. Probably not good for this site... - TPWang
Really, "adb reboot" (will restart your device) worked for me. - Shamm

6 Answers

17
votes

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.

5
votes

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.

5
votes

I think this might help...

for windows run cmd from "As Administrator" then

netsh int ip reset

For Mac users

  1. Click the Apple icon in the top left-hand corner and then select System Preferences from the drop-down menu.

  2. Select Network.

  3. Select your Connected internet connection (Ethernet or Wi-Fi) and then click Advanced.

enter image description here

  1. Select the TCP/IP tab and then click Renew DHCP Lease. And press Ok

enter image description here

2
votes

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.

2
votes

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

1
votes

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.