Skip to content

Wireless debugging ​

Everything from the last two lessons also works over Wi-Fi. This lesson covers the two ways to set that up, why the older one leaves a door open, and how to close it again.

Why trust is harder without a cable ​

Over USB, the cable proves the phone is in your hands. Over Wi-Fi, any device on the network could knock. So each method needs a way to decide who is let in.

Wireless debugging (pairing)adb tcpip 5555
Android versions11 and newerAny
First stepPair once with a six-digit code shown on the phoneConnect over USB first
PortA random port, shown on the phone5555
ConnectionEncryptedNot encrypted
How it endsTurn Wireless debugging off, or leave the networkadb usb, or restart the phone

Both methods need the phone and the computer on the same network. Guest Wi-Fi and many office networks stop devices from seeing each other, so they will not work there.

An address for ADB is written host:port: the phone's IP address, a colon and a port number, such as 192.168.1.42:41567. A port is a numbered door on a device; one device can listen on many.

Pair with a code (Android 11 and newer) ​

Pairing is a one-time introduction. The phone shows a code, the computer proves it has seen the code, and they exchange keys. After that the computer can connect whenever Wireless debugging is on.

text
 1. PAIR (once)                          2. CONNECT (each time)

 computer ── adb pair ──► phone          computer ── adb connect ──► phone
            192.168.1.42:37123                      192.168.1.42:41567
            + code 482913                           (a different port)
  1. On the phone, open Developer options, then Wireless debugging, and turn it on. Android asks whether to allow wireless debugging on this network; allow it only on a network you trust.

  2. Select Pair device with pairing code. The phone shows a six-digit code and an IP address and port.

  3. On the computer, pair with that address and port, then type the code when asked:

    text
    $ adb pair 192.168.1.42:37123
    Enter pairing code: 482913
    Successfully paired to 192.168.1.42:37123 [guid=adb-…]
  4. Back on the main Wireless debugging screen, read the IP address & Port shown there. The port is different from the pairing port.

  5. Connect to that address:

    text
    $ adb connect 192.168.1.42:41567
    connected to 192.168.1.42:41567

adb devices now lists the phone under its address:

text
$ adb devices
List of devices attached
192.168.1.42:41567      device

The code and the pairing port only work while the pairing window is open on the phone. The connect port can change each time you turn Wireless debugging on, so read it again if a saved address stops working.

In DroidDeck, steps 3 and 5 are the Pair a device (Android 11+) and Connect by IP cards on the Wireless tab. DroidDeck also remembers each address under Saved devices for one-click reconnects. See Connect over Wi-Fi.

The old way: adb tcpip 5555 ​

Before Android 11 there was no pairing. Instead, while the phone is connected over USB and authorised, you tell its daemon to listen on the network as well:

text
$ adb tcpip 5555
restarting in TCP mode port: 5555

Find the phone's Wi-Fi address under Settings › About phone (on some phones inside Status), or with adb shell ip addr show wlan0, then connect and unplug the cable:

text
$ adb connect 192.168.1.42:5555
connected to 192.168.1.42:5555

It works on any version, which is why many guides still teach it. DroidDeck has it too, as Enable tcpip :5555 on the Wireless tab.

Why it is risky on a shared network ​

After adb tcpip 5555, the phone listens for debugging on port 5555 to anyone on the network, not only to you, and keeps listening until you switch it back or restart the phone. DroidDeck puts it in one line under the button: TCP debugging stays open on the device until reverted — anyone on the same network can try to connect to port 5555.

What protects you then:

  • A new computer still has to be authorised, so the phone shows the Allow USB debugging? prompt. A tap on Allow by mistake, or by someone who has your phone in hand, lets them in.
  • Some devices, especially older or custom builds and some TV boxes, do not ask at all.
  • The traffic is not encrypted. Someone on the same network can read what you send, including files you push and pull.

So use tcpip only on a network you control, such as your home Wi-Fi, never in a café, a hotel, a shared office or a university network, and switch it back as soon as you are done.

Disconnect and switch back ​

To do thisCommandElsewhere
Drop one wireless connectionadb disconnect 192.168.1.42:41567
Drop every wireless connectionadb disconnect
Stop a phone listening after tcpipadb usb (prints restarting in USB mode)DroidDeck: Revert to USB on the Wireless tab
Stop Android 11+ wireless debuggingTurn Wireless debugging off on the phone

adb disconnect only ends your computer's connection. After tcpip, the phone is still listening for everyone else until you run adb usb or restart it. That is the step people forget.

Stay safe ​

  • Prefer pairing on Android 11 and newer. It is encrypted, and only computers that saw the code can pair.
  • Never leave tcpip mode on. Run adb usb or select Revert to USB when you finish, and check for it again after you lend the phone to anyone.
  • Turn Wireless debugging off when you are done. Each paired computer is listed under Paired devices on the Wireless debugging screen; remove ones you no longer use.
  • Say no to surprise prompts. An Allow USB debugging? prompt you did not cause, while the phone is on Wi-Fi, is someone else trying to connect.
  • Only connect to devices you own or are allowed to test. Scanning a network for open port 5555 on other people's devices is an intrusion, not a test.

Check yourself ​

QuizWireless debugging

Question 1 of 5

You paired successfully, then adb connect to the same address and port fails. What is the likely reason?

$ adb pair 192.168.1.42:37123
Successfully paired to 192.168.1.42:37123 [guid=adb-…]
$ adb connect 192.168.1.42:37123
Score: 0

What you learned ​

  • Android 11 and newer pair once with a six-digit code, then connect on a second, different port; the connection is encrypted.
  • adb tcpip 5555 works on any version, but opens port 5555 to everyone on the network, unencrypted, until adb usb or a restart.
  • adb disconnect ends your connection; it does not close the door on the phone.

Next steps ​