73

I am debugging USB devices connected to my Android phone, this means I cannot use ADB over a USB connection. How can I connect to adb over WiFi?

Note: Similar question here refers to adb over tcp, however, I'm specifically asking about WiFi.

Community
  • 1
  • 1
donturner
  • 17,867
  • 8
  • 59
  • 81
  • 1
    There is a plugin for Android Studio. https://github.com/pedrovgs/AndroidWiFiADB Work with it is very easy and has a great explanation on the read-me page. After connecting device to the adb over wi-fi it acts as normal connected device – loshkin Feb 21 '17 at 10:14
  • Yes Android Wifi ADB plugin is there and you can install from android studio refer this link https://android.jlelse.eu/connect-android-device-with-wifi-within-android-studio-3b1bc00c1e17 – Naveen Kumar M Jun 08 '18 at 07:25

3 Answers3

207
  • Connect Android phone and host machine to same WiFi network
  • Connect Android phone to host machine using USB cable (to start with)
  • Run adb tcpip 5555 from a command prompt
  • Run adb shell "ip addr show wlan0 | grep -e wlan0$ | cut -d\" \" -f 6 | cut -d/ -f 1" to obtain the phone's IP address
  • Disconnect USB cable and run adb connect <ip_address>:5555

You can now view logcat output by running adb logcat or by viewing the Android Monitor tab within Android Studio.

donturner
  • 17,867
  • 8
  • 59
  • 81
  • 12
    Or to get the IP address in a "simpler" (well, faster) way: `adb shell "ifconfig | grep -A 1 wlan0 | tail -n 1 | cut -f2 -d: | cut -f1 -d' '"` – ereOn Jun 12 '17 at 01:17
  • 2
    When USB cable doesn't work, how can I get wifi to work? – david.perez Mar 09 '18 at 10:31
  • 6
    Using `ifconfig` on Android Q I get `ifconfig: ioctl 8927: Permission denied`. I've updated my answer to use `ip addr show wlan0` instead. – donturner Apr 04 '19 at 19:21
  • This doesn't work – IgorGanapolsky May 10 '19 at 20:40
  • 1
    What doesn't work? Please be specific. – donturner May 12 '19 at 00:14
  • Does the device needs to be rooted @donturner ? – TSR Jun 14 '19 at 13:49
  • 1
    No, rooting is not necessary – donturner Jun 17 '19 at 19:52
  • it's like 5x slower(has to be noted), but works – madwyatt Jul 07 '19 at 23:12
  • Does it still work in android pie? – bikram Aug 28 '19 at 04:55
  • It seems I need to do it again next time, when my phone, or wifi, or laptop has rebooted.. is that correct? – iago-lito Sep 10 '19 at 15:27
  • 4
    Is there anyway to get around having to make the initial physical connection? Sometimes when I'm debugging its a hassle to go find a cord... could i write an app that makes my phone get into a state that will allow the connection without needing to be plugged in? – Quinn Jan 03 '20 at 20:08
  • I worked, but.. How to get back to USB cable connectiion? – exebook Mar 21 '20 at 11:55
  • Is it working on Redmi/Xiaomi devices when both laptop and mobile are connected to hotspot from Samsung or other phone? – GD- Ganesh Deshmukh Mar 24 '20 at 04:50
  • To retrieve the phone IP Address if the pc is connected to the mobile Hotspot, type IPCONFIG in cmd and from the list use Default Gateway address to connect to phone via ADB – esnezz May 29 '20 at 11:26
  • there are many tutorials on it, but they say run the command ADB connect :5555 while you are connected with USB but it was trying this way and as soon as I remove USB the device became lost, but the right way is to remove the device first and then run the command, the second day I catch where I did mistake....Thanks so much – Himanshu Sep 29 '20 at 06:23
  • Maybe you can link to the official documentation : https://developer.android.com/studio/command-line/adb#wireless – FF_Dev Oct 24 '21 at 07:42
  • If you are using your phone as a hotspot and want to get its IP to connect to it, use `adb shell "ip addr show rmnet4 | grep 'inet ' | cut -d ' ' -f 6 | cut -d / -f 1"` – Bakr Feb 10 '23 at 16:55
  • I don't have my workstation available right now so I can't check, but the process described here https://developer.android.com/tools/adb#wireless-android11-command-line doesn't seem to require the initial usb connection. – Mike Jack Apr 21 '23 at 07:19
9

if you are using android studio.Just Download the plugin AndroidWifiADB for android studio.

frogatto
  • 28,539
  • 11
  • 83
  • 129
Pratik Gondil
  • 689
  • 1
  • 6
  • 17
  • 5
    this solution also requires that you first plug in via USB, which in some situations is not workable. – Michael May 13 '20 at 03:04
0

You can adb over wifi using the app Wifi-ADB. The app requires superSU permissions hence the android phone you want to connect over WiFi must be rooted.