15

I'm basically trying to do this: How can I connect to Android with ADB over TCP? with the Droid X2.

I have USB Debugging on, and my phone is plugged in via USB. The IP Address is 10.0.78.33 (I have verified that I can do TCP communication to the phone on that IP, and I can ping it).

I go to the command line and do the following:

>>adb tcpip 5555

restarting in TCP mode port: 5555

>>adb connect 10.0.78.33:5555

unable to connect to 10.0.78.33:5555

Any thoughts on why this doesn't work? Do I need root access in order to do this? I'm trying to avoid rooting the phone.

Thanks!

Community
  • 1
  • 1
J J
  • 1,550
  • 4
  • 17
  • 27
  • 1
    Open up a terminal emulator on the phone, and from that shell try 'netstat -n' and see if it's actually listening on port 5555 after you tell it to. – Chris Stratton Jun 11 '11 at 02:59
  • Good catch... 'netstat -n' showed the headers without any rows under it. I then tried the console (very handy btw) to switch to tcpip for adb directly on the phone - again no errors, seemed to work, except still the same error on the PC side. Interestingly enough, when I try to run an app from Eclipse over USB it still deployed and ran - even more reason to think that it didn't actually switch to TCP. I wonder why there was no warning/error. Any thoughts? – J J Jun 11 '11 at 04:09
  • ran >>setprop service.adb.tcp.port 5555 >>stop adbd >>start adbd And then tried 'adb devices' from the PC and it still does my android device as connected :/ – J J Jun 11 '11 at 04:14
  • What does getprop | grep adb say? – Chris Stratton Jun 11 '11 at 04:33
  • [persist.service.adb.enable]: [1]
    [ro.sys.atvc_allow_all_adb]: [0]
    [init.svc.adbd]: [running]. Does that tell you anything? Sorry, unix(?) terminal commands are pretty foreign to me...
    – J J Jun 11 '11 at 05:01
  • 1
    Well it seems your setprop service.adb.tcp.port didn't work. IIRC you have to be root for that. – Chris Stratton Jun 11 '11 at 05:03
  • Answered a similar question here: http://stackoverflow.com/questions/11074868/android-adb-tcpip-error/ and `setprop` needs root of course. – soulseekah Oct 22 '12 at 09:24
  • 1
    possible duplicate of [ADB over wireless](http://stackoverflow.com/questions/14357705/adb-over-wireless) – Audrius Meškauskas May 20 '13 at 08:28
  • Download a script to do that just provide your IP and done [wireless.bat](http://stackoverflow.com/a/38415096/6598402) – Astik Sachan Jul 16 '16 at 20:07

13 Answers13

35

Step 1 . Go to Androidsdk\platform-tools on PC/Laptop

Step 2 :

Connect your device via USB and run:

adb kill-server

then run

adb tcpip 5555

you will see below message...

daemon not running. starting it now on port 5037 * daemon started successfully * restarting in TCP mode port: 5555

Step3:

Now open new CMD window,

Go to Androidsdk\platform-tools

Now run

adb connect xx.xx.xx.xx:5555 (xx.xx.xx.xx is device IP)

Step4: Disconnect your device from USB and it will work as if connected from your Android studio.

Ajith George
  • 869
  • 8
  • 8
13

Symptoms

With my phone, this problem happens a lot. I get these symptoms:

  • ping x.x.x.x times out
  • adb connect x.x.x.x times out ("unable to connect")
  • telnet x.x.x.x 5555 times out

Workaround

I need to disable and re-enable WiFi on my phone before running adb connect on my computer. Then I can both ping, telnet, and adb connect to the phone.

I'm using a Sony Xperia M C1904 running CyanogenMod 12.1.

Community
  • 1
  • 1
Sam
  • 40,644
  • 36
  • 176
  • 219
  • This will be network level (if you can't ping the device) before getting into adb connectivity issues. You might find the hadset is switching between different frequency bands (wifi) or mobile/wifi. Ensure you haven't enabled either Also check you have both these Developer options *disabled*: Agressive WiFi to Mobile Handoff Mobile Data always active – simon coleman Nov 23 '18 at 17:15
  • 1
    Disabling and re-enabling the wifi on my phone LG-H870 did the trick! – NooberMan Nov 26 '20 at 09:24
9

Your device hasn't to be rooted. I've developed a plugin for IntelliJ/Android Studio to connect your device over wifi pressing just one button. Here is the code and here the plugin ready to be used.

The usage is quite simple. Here you have a gif:

enter image description here

5

In my case i need pair device with code.

  1. in phone "For developers" -> "Wifi debug" -> "Connect with code"
  2. adb pair x.x.x.x:xxxxx password
  3. adb connect x.x.x.x:xxxxx
Андрей
  • 166
  • 2
  • 7
2

Root IS needed to change that system properties. However, it is not needed to start adb over wifi.
You can forward the ports while connected through USB and then tell the adb daemon to listen over a certain frequency:
ADB over wirless

Community
  • 1
  • 1
cnexus
  • 454
  • 1
  • 3
  • 14
2

I've encoutered the same problem, and my device was rooted. The problem actually came from adbd Insecure. If you installed adbd Insecure on your device, it will prevent you from connecting to your device via WiFi. You have to uncheck the "Enable insecure adbd" in the app adbd Insecure.

See FIXED: Can't connect to adb over wifi

Community
  • 1
  • 1
matthieu
  • 1,412
  • 1
  • 11
  • 33
1

The problem with me for my Samsung Tab 1 was an adb process was already running on port 5037 on my Xubuntu 14.04 machine, which I was unaware about until I typed pgrep -l -u username. To fix this, I terminated the adb process using pkill adb, navigated to my platform tools folder and ran adb tcpip 5037 and then connected to my device using the 5037 port number. Boom! Worked like a charm.

Akash Agarwal
  • 2,326
  • 1
  • 27
  • 57
1

Android wifi ADB was earlier working on my IDE but after Updating Android Studio (my current is Android Studio 3.3) it is not working and always prompt as "Unable to connect to device......Same network"

After spending much time i was unbale to resolve the issue.

Then i tried - WIFI ADB ULTIMATE by

https://github.com/huazhouwang/WIFIADB/tree/master/WIFIADBIntelliJPlugin

It worked for me.

Zafar Imam
  • 319
  • 3
  • 11
1

I know it's an old thread and OP is asking in very common scenario but I would like to mention what happened with me.

I was able to connect to ADB over wifi through below steps:

  • connect android phone to computer via USB (critical initial step)
  • open terminal in android studio & navigate to where the adb is installed
  • execute command adb tcpip 5555. this will restart the adb in TCP mode port: 5555
  • execute command adb connect <ip address>
  • for first time you might need to give access to adb from phone when asked
  • after connection establishes, you can disconnect the usb cable and you're good to go.

This worked all the time when I'm on my home wifi.

Twist:

I got the error saying failed to connect to '172.16.224.20:5555': Connection refused, when i tried to connect from Starbucks cafe wifi (or any other public wifi).

After some research I realized that

many public wifi has some configuration restrictions which doesn't allow adb over wifi

.

Keval Langalia
  • 1,762
  • 1
  • 16
  • 29
0

After you run setprop service.adb.tcp.port 5555 and restart adb you won't see the device if you run adb devices on the host.

Instead, you have to run adb connect 10.0.78.33:5555

Joseph Earl
  • 23,351
  • 11
  • 76
  • 89
0

I couldn't connect adb to my Nexus5 Phone over 5Ghz WLAN but it did work with the slower 2,4 Ghz instantly.

Michael D.
  • 1,795
  • 2
  • 18
  • 25
0

I hope this will helpful and worked for me

  1. Disconnect phone from studio.
  2. Go to developer options in phone.
  3. Under USB debugging, there is an option to Revoke USB debugging authorisations.
  4. Then click ok.
  5. Then again connect phone to studio via USB.
  6. Then click on connect button in ADB Wifi.
  7. Now you can run and debug apps without USB
Joyal Jose
  • 11
  • 4
0

Restart your adb server with higher port. I was trying to use adb on 5555 port but it didnt connect and when i started server on 50370 it connected instantly