99

Hey i was wondering do you need root to do this any more? I want to install/run apps over wireless to stop all this cable switching. I have also read that it can cause some errors though? That was on old posts on this site, I was wondering is it reliable and easy to do now?

Paul
  • 5,756
  • 6
  • 48
  • 78
  • tablet is running ICS, I'm using min sdk 14 – Paul Jan 16 '13 at 11:54
  • Did you actually get this working? I can see you've accepted the top answer, but your comments suggest it still wasn't working for you. I've got the same problem. – Sam May 31 '15 at 05:04
  • Starting from Android 11 [you could achieve this easily](https://stackoverflow.com/a/63988041/7356355) without using a USB cable at all : – user158 Sep 21 '20 at 07:46

6 Answers6

238

Rooting is not required. With USB cable connected, port 5555 opened across all involved firewalls and debug mode enabled

adb tcpip 5555

then look into wireless properties of your device and the network you use, to see which IP address have been granted to device (or configure your DHCP always to use the same for the device mac address). Then

adb connect 192.168.1.133

(were 192.168.1.133 is a sample IP address).

This is all. You can now use adb shell or adb install or adb upload or the like with USB cable plugged out.

To switch back to USB mode,

adb usb

The device may also revert back to USB mode after reboot.

This mode is needed for development of applications that use attached USB devices directly (USB port is used by device so cannot be used by ADB). It is briefly covered in the USB debugging section of the Android website.

Audrius Meškauskas
  • 20,936
  • 12
  • 75
  • 93
  • 1
    thanks, tried this but get 'unable to connect to '. i'll investigate. – Paul Jan 16 '13 at 12:01
  • 1
    Check if the port 5555 is not closed by firewall and if your IP address is correct. It is the device IP address, not the local address of connecting computer. I have tested all these commands before posting here. – Audrius Meškauskas Jan 16 '13 at 12:03
  • Yes it must be closed: sudo nmap 10.10.5.121 Starting Nmap 5.21 ( http://nmap.org ) at 2013-01-16 12:06 GMT Nmap scan report for 10.10.5.121 Host is up (0.0000020s latency). Not shown: 997 closed ports PORT STATE SERVICE 22/tcp open ssh 443/tcp open https 902/tcp open iss-realsecure – Paul Jan 16 '13 at 12:07
  • no matter what port I change to it always says failed to connect to 5555, how do I get rid of that? – Paul Jan 16 '13 at 12:35
  • 2
    adb connect 192.168.1.133:YOUR_PORT – Audrius Meškauskas Jan 16 '13 at 13:58
  • I had tried that, so when I enter that I get could not connect to 192.168.1.133:YOUR_PORT:YOUR_PORT if I dont specify port I get could not connect to 192.168.1.133:5555. I'll just restart the computer but I was just wondering why this was. – Paul Jan 16 '13 at 14:00
  • Still there if I restart PC. so If I say adb tcpip 22. then adb connect 192.168.1.133 it tries to connect to 192.168.1.133:5555, and if I say adb connect 192.168.1.133:22 it tries to connect to 192.168.1.133:22:22 – Paul Jan 16 '13 at 14:45
  • 4
    One hidden step I found that I needed to do for mine, is you need to ping the device once in a while what you are wirelessly connected and about to upload code. If your android device goes to sleep, or is inactive for a bit, you may need to unlock the screen and on a separate command prompt, type `ping 192.168.1.X` to wake up its network connection. – phyatt Oct 04 '13 at 00:00
  • 12
    Tip: To easily find the device ip, _before_ all this do: `adb shell ifconfig wlan0` – Mattias Isegran Bergander Feb 20 '14 at 19:40
  • is there is anyway u can connect without one time connection through USB – Muneef M Nov 17 '19 at 04:20
  • @MattiasIsegranBergander when I do this I get ifconfig: ioctl 8927: Permission denied – Cornelius Roemer Dec 24 '19 at 14:48
14

I ran into the same problem today and find that things are fine on my non-rooted 4.2 Galaxy Nexus device, but does not work on my older (again non-rooted) Samsung Galaxy Y (2.3) device.

I tried the steps given here but looks like one needs a rooted phone to work on some of the earlier models (and maybe other non-nexus devices too).

This is what I tried -

$ adb shell netstat | grep 5555

No socket was opened on this port.

Tried to manually set the steps that adb tcpip does -

$ adb shell setprop service.adb.tcp.port 5555
$ adb shell stop adbd
$ adb shell start adbd
$ adb shell getprop | grep adb

This does not show the property that was just set.

This is what it shows on my nexus device where it works without rooting -

$ adb shell getprop | grep adb
[service.adb.tcp.port]: [5555]

So depending on what phone/OS version u have, your mileage might vary.

:-)

Community
  • 1
  • 1
  • Silly question - how do you start adbd again after stopping it? Once I stop it the phone disconnects from ADB and I can't reconnect to it. – ZoFreX Feb 03 '14 at 18:10
12

For wireless adb on my Nexus 4 @ Android 4.4.2 (Kitkat) I usually do:

  1. Turn on usb debug in 'Developer options'
  2. Connect via usb cable, accept an RSA key dialog
  3. adb tcpip 5555
  4. adb connect 192.168.?.? (device IP on local wlan)
  5. Disconnect usb cable

  6. Test if connection is still on: adb devices

Community
  • 1
  • 1
DmitrySandalov
  • 3,879
  • 3
  • 23
  • 17
1

No root required

For wireless ADB without USB cable is possible but you need to use one time setup connection with PC using usb cable. make sure USB debugging mode should be on. Connect device on same wifi. then run

  • adb tcpip 5555
  • adb connect yourdeviceIP

To find current device IP and to setup adb wireless use app (without rooting device)

https://play.google.com/store/apps/details?id=com.freeappmakr.adb

Using this app you can setup your device with wireless adb.

If any error in setup use

adb kill-server

then try again

Yogesh
  • 11
  • 1
0

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
0

While writing this answer, things have become much easier since the accepted answer.

To connect to an android device over adb wirelessly, follow the following steps:

  1. Turn on "Developer Options" by tapping on the build number at least 7 times, during the process you will get a toast saying 'X number of taps remaining to enable developer options'.
  2. Once enabled, head over to the "Developer Options" which will now be visible as the main option under the Settings app, usually placed at the very bottom.
  3. Now go to Debugging > Wireless Debugging or simply search for Wireless debugging once inside the developer options. Turn on the wireless debugging. Now tap on the wireless debugging option.
  4. Once inside, note your IP address and port. Let's call it IP1.
  5. Now tap on 'Pair with pairing code'. You will be presented with a second IP address and port and a pairing code. Let's call it IP2. We will pair our device to register our device fingerprint using IP2 and connect the device to your PC using IP2. Before moving forward make sure your PC and android device are on the same wifi network and adb is globally accessible from your terminal.
  6. Open the terminal and enter adb pair IP2. Enter the pairing code when prompted. And now you are successfully paired with your PC.
  7. Now to connect to your PC, enter the command adb connect IP1. And now you are successfully connected to your PC.
  8. To check whether the connection was successful or not, enter the command adb devices and now you should see your phone listed as one of the devices.

Note: IP1 and IP2 are IP addresses including ports

Once paired there's no need to pair again even if the wireless debugging connection is lost, simply run the connect command again.

nimish642
  • 29
  • 8