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 versions | 11 and newer | Any |
| First step | Pair once with a six-digit code shown on the phone | Connect over USB first |
| Port | A random port, shown on the phone | 5555 |
| Connection | Encrypted | Not encrypted |
| How it ends | Turn Wireless debugging off, or leave the network | adb 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.
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)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.
Select Pair device with pairing code. The phone shows a six-digit code and an IP address and port.
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-…]Back on the main Wireless debugging screen, read the IP address & Port shown there. The port is different from the pairing port.
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:
$ adb devices
List of devices attached
192.168.1.42:41567 deviceThe 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:
$ adb tcpip 5555
restarting in TCP mode port: 5555Find 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:
$ adb connect 192.168.1.42:5555
connected to 192.168.1.42:5555It 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 this | Command | Elsewhere |
|---|---|---|
| Drop one wireless connection | adb disconnect 192.168.1.42:41567 | |
| Drop every wireless connection | adb disconnect | |
Stop a phone listening after tcpip | adb usb (prints restarting in USB mode) | DroidDeck: Revert to USB on the Wireless tab |
| Stop Android 11+ wireless debugging | Turn 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
tcpipmode on. Runadb usbor 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
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:37123What 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 5555works on any version, but opens port 5555 to everyone on the network, unencrypted, untiladb usbor a restart.adb disconnectends your connection; it does not close the door on the phone.
Next steps
- Lesson 4: Logcat and crashes: read what the phone is saying
- Connect over Wi-Fi in DroidDeck
- Wireless troubleshooting