Android: Use ADB wirelessly via Wi-Fi

In this post you will learn how to connect Android Debug Bridge (ADB) wirelessly via Wi-Fi instead of using a USB-cable.

Assumptions

  • Your Android-device has a Wi-Fi connection;
  • Your workstation has a TCP/IP connection which is routable to the Android-device;
  • Your Android-device is connected with your workstation using a USB-cable;
  • ADB is installed on your workstation;
  • You can connect via ADB with your Android device;
  • There is just one unique Android-device connected with the workstation (either via USB or WIFI).

Procedure

Steps to switch your Android-device from using USB to WIFI:

  1. Make sure your Android-device is connected via USB with your workstation and can be accessed via ADB
    adb devices

    The response should be something like this:

    List of devices attached
    SOME_ANDROID_DEVICE device
  2. Find the IP address of your Android device. Either by looking it up in the router/DHCP-leases or ask it the device directly via ADB.
    adb shell ip -f inet addr show wlan0

    It will respond like this:

    7: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
    inet 192.168.178.100/24 brd 192.168.178.255 scope global wlan0
    valid_lft forever preferred_lft forever

    Here the IP address is: 192.168.178.100

  3. Tell the ADBD daemon at the Android device to start listening for TCP/IP connections on port 5555. Execute this command from your workstation:
    adb tcpip 5555

    It will respond with:

    restarting in TCP mode port: 5555

    .

  4. Tell the ADB server at the workstation to connect via TCP/IP to the Android device. Use in this command the IP-address you looked up before.
    Execute at your workstation:

    adb connect 192.168.178.100:5555

    and it will respond with:

    connected to 192.168.178.100:5555

    Hint: Make sure your firewall accept these kind of connections.

  5. Check the possible connections with your Android-device. Ask ADB for the connected devices by issuing this command from your workstation:
    adb devices

    . The response should be:

    List of devices attached
    192.168.178.100:5555 device
    SOME_ANDROID_DEVICE device

    Now there are two ways to connect with the Android-device:

    1. The new method via WIFI and;
    2. The old one via the USB-connection

    When you don’t want to explicitly state every time you use ADB to which specific device (parameter: -s) the command is targeted, it is a good moment to disconnect the USB-cable now. This is directly a proof that command travel through the air from now on.

  6. Issue an ADB-command. For example ask information about the CPU:
    adb shell cat /proc/cpuinfo

    . Your device should respond with something like this:

    Processor : ARMv7 Processor rev 3 (v7l)
    processor : 0
    BogoMIPS : 1191.73
    Features : swp half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpv4 idiva idivt
    CPU implementer : 0x41
    CPU architecture: 7
    CPU variant : 0x0
    CPU part : 0xc07
    CPU revision : 3
    Hardware : MT8127
    Revision : 0000
    Serial : 0000000000000000<

Extra: When you would like to restart the ADBD daemon at the Android device in USB mode again, issue the command:

adb usb

Warning, you will lose the ADB-WIFI connection immediately. Start with step 3 (adb tcpip 5555) to set up the ADB-WIFI connection again.

This tutorial was written using as workstation a computer running Ubuntu (16.10), using version 1.0.36 of ADB. The target device was a Lenovo Essential Tab7 running Android version: 5.0.1.

Read more