adb-wifi-qr
Pair an Android 11+ device for wireless ADB by scanning a QR code rendered in your terminal.
This is a Python port of adb-wifi by
saleehk. All credit for the original idea and
JavaScript implementation goes to him.
What it does
- Generates a random one-time name and password.
- Renders a Wi-Fi-format QR code (
WIFI:T:ADB;S:<name>;P:<password>;;) directly in your terminal. - Listens for the phone's
_adb-tls-pairing._tcp.localmDNS advertisement. - Runs
adb pair <host>:<port> <password>against the first device it finds. - (optional) With
--connect, also discovers_adb-tls-connect._tcp.localand runsadb connect, so the device shows up inadb devicesand is ready foradb shell,adb install, etc.
Requirements
- Python 3.8 or newer (3.9+ recommended — the pinned
zeroconfbranch is the last to support 3.8). adbonPATH(or pass--adb /path/to/adb). Install it with the Android SDK platform-tools.- Android 11+ device on the same Wi-Fi network as the computer.
Install
pip install adb-wifi-qr
Usage
adb-wifi-qr
The terminal prints a QR code. On the Android device:
- Open Settings → System → Developer options → Wireless debugging.
- Tap Pair device with QR code.
- Point the camera at the QR code in your terminal.
The tool detects the device via mDNS and runs adb pair automatically.
Examples
Pair only (default — matches the original adb-wifi):
adb-wifi-qr
Pair and auto-connect, so the device immediately shows up in adb devices:
adb-wifi-qr --connect
Wait up to two minutes for the device (default is 60 s):
adb-wifi-qr --timeout 120
Enable debug logging (mDNS events, full subprocess output):
adb-wifi-qr -v
Use a non-default adb binary:
adb-wifi-qr --adb /opt/android-sdk/platform-tools/adb
Combine flags freely:
adb-wifi-qr --connect --timeout 120 -v
All flags
| Flag | Default | Description |
|---|---|---|
--timeout SECONDS |
60 |
How long to wait for the device to advertise itself. |
--connect |
off | After pairing, also run adb connect so the device joins adb devices. |
--adb PATH |
adb |
Path to the adb binary. |
-v, --verbose |
off | Debug logging to stderr. |
--version |
– | Print the package version and exit. |
--help |
– | Print full help and exit. |
How it works
Android 11 introduced wireless debugging. When the user opens Pair device
with QR code, the phone briefly advertises an mDNS service of type
_adb-tls-pairing._tcp.local on the local network. Scanning the QR code tells
the phone which (random) credentials the pairing request will use; the
computer-side adb pair host:port password completes the handshake.
adb-wifi-qr starts the mDNS listener before rendering the QR so the
discovery is already running the moment the user taps Pair device with QR
code — the advert is short-lived.
Troubleshooting
adbnot found. Install Android platform-tools, or pass--adbwith the full path.- No device found before timeout. Make sure the pairing dialog is actually
open on the phone — the mDNS advertisement only exists while that screen is
visible. Re-run with
--timeout 120if you need more time, or-vto watch the mDNS events live. - Phone and laptop on different subnets / VPN active. mDNS does not cross subnets. Disable the VPN or move both devices onto the same Wi-Fi.
- QR code does not scan. Make the terminal window wider, increase the font size, or switch to a dark background — phone cameras pick up the half-block glyphs much better with white-on-black contrast.
adb pairfails. Just re-runadb-wifi-qr— each invocation generates fresh credentials. The previous QR cannot be reused.
Development
git clone https://github.com/matevosashot/adb-wifi-python
cd adb-wifi-python
pip install -e ".[dev]"
pytest
Tests mock the zeroconf and subprocess boundaries, so they do not require a
real Android device or network access.
License
ISC — see LICENSE.
Credits
- Original implementation: saleehk/adb-wifi.
- This Python port: matevosashot/adb-wifi-python.
Metadata
Release files for adb-wifi-qr 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| adb_wifi_qr-0.2.0.tar.gz | 10.7 kB | Without provenance | Details for adb_wifi_qr-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| adb_wifi_qr-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for adb_wifi_qr-0.2.0-py3-none-any.whl |
Total release size: 20.7 kB
Release files / adb_wifi_qr-0.2.0.tar.gz
| Download URL | adb_wifi_qr-0.2.0.tar.gz |
|---|---|
| Size | 10.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1125c654f3ad77a599255ced3f692cbac5bd7e139bd2be1f904be8ec2030367e
|
|
BLAKE2b-256 checksum How to use checksums |
3b93cf55901e82b7cc55d5c5f1290f69d9abfc6baa457a339c8849efeae06732
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Release files / adb_wifi_qr-0.2.0-py3-none-any.whl
| Download URL | adb_wifi_qr-0.2.0-py3-none-any.whl |
|---|---|
| Size | 10.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0d2a1c109f8f063f91b9a6df07786d81c0662a53befc5e0b64603197a39d67a4
|
|
BLAKE2b-256 checksum How to use checksums |
9b223ee47cc0504b80ec867788311d1d27ece28814d88a87beb0dc13516d9ce8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Security for adb-wifi-qr 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.