Connect ADB to a device via WiFi

suggest change

The standard ADB configuration involves a USB connection to a physical device.

If you prefer, you can switch over to TCP/IP mode, and connect ADB via WiFi instead.

Not rooted device

  1. Get on the same network:
  1. Connect the device to the host computer with a USB cable.
  2. Connect adb to device over network:

While your device is connected to adb via USB, do the following command to listen for a TCP/IP connection on a port (default 5555):

For example:

adb tcpip 5555
adb connect 192.168.0.101:5555

If you don’t know your device’s IP you can:

1. Connect the device to the computer via USB
2. In a command line, type `adb shell ifconfig` and copy your device's IP address

To revert back to debugging via USB use the following command:

adb usb

You can also connect ADB via WiFi by installing a plugin to Android Studio. In order to do so, go to Settings > Plugins and Browse repositories, search for ADB WiFi, install it, and reopen Android Studio. You will see a new icon in your toolbar as shown in the following image. Connect the device to the host computer via USB and click on this AndroidWiFiADB icon. It will display a message whether your device is connected or not. Once it gets connected you can unplug your USB.


Rooted device

Note: Some devices which are rooted can use the ADB WiFi App from the Play Store to enable this in a simple way. Also, for certain devices (especially those with CyanogenMod ROMs) this option is present in the Developer Options among the Settings. Enabling it will give you the IP address and port number required to connect to adb by simply executing adb connect <ip address>:<port>.

When you have a rooted device but don’t have access to a USB cable

The process is explained in detail in the following answer: http://stackoverflow.com/questions/2604727/how-can-i-connect-to-android-with-adb-over-tcp/3623727#3623727 The most important commands are shown below.

Open a terminal in the device and type the following:

su
setprop service.adb.tcp.port <a tcp port number>
stop adbd
start adbd

For example:

setprop service.adb.tcp.port 5555

And on your computer:

adb connect <ip address>:<a tcp port number>

For example:

adb connect 192.168.1.2:5555

To turn it off:

setprop service.adb.tcp.port -1
stop adbd
start adbd

Avoid timeout

By default adb will timeout after 5000 ms. This can happen in some cases such as slow WiFi or large APK.

A simple change in the Gradle configuration can do the trick:

android {
    adbOptions {
        timeOutInMs 10 * 1000
    }
}

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


ADB Android Debug Bridge:
* Connect ADB to a device via WiFi
* Backup

Table Of Contents
2 Gradle
5 Intent
17 Service
19 WebView
31 SQLite
32 ADB Android Debug Bridge
35 Glide
37 Dialog
38 ACRA
44 Handler
53 Toast
63 Menu
65 Picasso
70 Volley
71 Widgets
78 Realm
90 Spinner
95 OkHttp
108 TextView
109 ListView
111 Loader
118 Xposed
119 Security
121 ImageView
123 Doze Mode
130 Drawables
131 Colors
134 Fresco
139 AdMob
145 Keyboard
146 Button
150 EditText
155 Vk SDK
163 ExoPlayer
169 XMPP
175 OpenCV
177 Threads
184 ORMLite
186 TabLayout
190 LruCache
192 Zip files
194 Fastlane
199 FileIO
202 Moshi
210 VideoView
216 Paint
218 ProGuard
226 CleverTap
228 ADB shell
229 Ping ICMP
230 AIDL
234 Context
240 JCodec
242 Okio
249 FuseView
254 Looper
261 Fastjson
263 Jackson
267 Smartcard