Can't connect to Android via ADB over wifi - Do I need root access?
Asked Answered
B

14

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!

Beutner answered 11/6, 2011 at 0:6 Comment(9)
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.Liger
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?Beutner
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 :/Beutner
What does getprop | grep adb say?Liger
[persist.service.adb.enable]: [1] <br> [ro.sys.atvc_allow_all_adb]: [0] <br> [init.svc.adbd]: [running]. Does that tell you anything? Sorry, unix(?) terminal commands are pretty foreign to me...Beutner
Well it seems your setprop service.adb.tcp.port didn't work. IIRC you have to be root for that.Liger
Answered a similar question here: https://mcmap.net/q/219475/-android-adb-tcpip-error and setprop needs root of course.Ileac
possible duplicate of ADB over wirelessStony
Download a script to do that just provide your IP and done wireless.batUnsnap
C
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.

Crushing answered 14/9, 2015 at 6:57 Comment(2)
after disconnecting its does not work on motorola handsets.... but if i run adb connect xxxx.... then it connects with handset...Impermeable
no, once I done this and disconnect my Honor 10 with Android 10 returns - device offineCuticula
B
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.

Brendin answered 31/5, 2015 at 5:14 Comment(2)
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 activePennon
Disabling and re-enabling the wifi on my phone LG-H870 did the trick!Alexandretta
M
10

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
Marybellemarybeth answered 10/7, 2022 at 18:9 Comment(1)
Note that the port number for pair and connect will be different!Intemerate
F
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

Foliolate answered 20/10, 2015 at 18:13 Comment(0)
C
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

Cohe answered 16/1, 2013 at 23:30 Comment(0)
B
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

Beckybecloud answered 24/6, 2015 at 15:18 Comment(0)
R
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.

Roehm answered 20/2, 2016 at 16:27 Comment(0)
E
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.

Eridanus answered 21/9, 2019 at 21:11 Comment(0)
C
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

.

Cailly answered 21/9, 2021 at 18:19 Comment(0)
S
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

Selfsufficient answered 19/7, 2012 at 11:46 Comment(0)
A
0

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

Arietta answered 11/8, 2014 at 16:4 Comment(0)
V
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
Vocalic answered 1/12, 2020 at 5:8 Comment(0)
T
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

Talented answered 2/3, 2023 at 14:26 Comment(0)
N
0

Use ADB-WiFi plugin and if still not connecting the just switch off and switch on wifi on you device before connecting.

Neoma answered 30/3 at 6:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.