adb-qr
Pair your Android phone for wireless debugging by scanning a QR code in your terminal — like Android Studio's "Pair device with QR code", but for the CLI. No typing pairing codes, no looking up IPs and ports.
Why another QR-pairing tool?
Existing tools (adb-wireless, adb-qr, and friends) run their own mDNS listener to discover the phone after it scans the QR. That works on a native host — and silently fails inside WSL2, containers, and VMs, where LAN multicast never reaches the virtualized network. The QR renders, the phone scans it, and then... nothing.
adb-qr doesn't listen for mDNS at all. It asks the adb server itself
what it sees (adb mdns services), so discovery happens wherever the server
runs. On WSL2, point it at the Windows adb.exe (it does this automatically)
and the Windows side — which can see your LAN — does the discovery. The
same trick means zero networking dependencies on any platform: if adb
works, adb-qr works.
Install
With uv (recommended):
uv tool install git+https://github.com/aleixrodriala/adb-qr
With pipx:
pipx install git+https://github.com/aleixrodriala/adb-qr
Or run it once without installing anything:
uvx --from git+https://github.com/aleixrodriala/adb-qr adb-qr
Requirements
- Android platform-tools 31+ on the host that has network visibility
(on WSL2: install them on Windows;
adb-qrfindsadb.exeby itself) - A phone on Android 11+, on the same Wi-Fi as that host
- Python 3.10+ (handled for you by
uv/pipx)
Usage
adb-qr # show QR, wait for scan, pair, connect
adb-qr --pair-only # stop after pairing (adb usually auto-connects anyway)
adb-qr --timeout 300 # wait longer for the scan
adb-qr --no-invert # flip QR colors if your phone won't scan it
adb-qr --adb /path/to/adb # explicit adb binary (env var ADB works too)
On the phone: Settings → Developer options → Wireless debugging → Pair device with QR code, and point the camera at your terminal.
How it works
The QR encodes WIFI:T:ADB;S:<name>;P:<password>;; — the same payload
Android Studio generates. When the phone scans it:
- The phone starts advertising an
_adb-tls-pairing._tcpmDNS service whose instance name is the<name>from the QR. adb-qrpollsadb mdns servicesuntil that service shows up, then runsadb pair <ip>:<port> <password>.- After pairing, the phone's
_adb-tls-connect._tcpservice is used toadb connect(recent adb versions often auto-connect on their own —adb-qrdetects that too and gets out of the way).
Troubleshooting
- QR won't scan — try
--no-invert; some terminal color schemes render the QR with polarity a given camera dislikes. - Times out waiting for scan — the phone must be on the same network as the machine where the adb server runs. On WSL2 that machine is Windows, not the WSL VM. Corporate/guest Wi-Fi often blocks mDNS entirely.
adb mdns checkfails —adb-qrforce-enables the openscreen mDNS backend (ADB_MDNS_OPENSCREEN=1) and restarts the server once; if it still fails, update platform-tools.- Paired but not connected — run
adb connect <ip>:<port>with the port shown on the phone's Wireless debugging screen (it differs from the pairing port).
Prior art
The pair-by-QR flow was pioneered for the terminal by
teamclouday/adb-wireless.
adb-qr exists because none of the existing tools survive WSL2's NAT — and
delegating discovery to the adb server turned out to make the whole thing
simpler, too.
License
MIT
Release files for adb-qr 0.1.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 | |
|---|---|---|---|
| adb_qr-0.1.0.tar.gz | 111.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| adb_qr-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 119.5 kB
Release files / adb_qr-0.1.0.tar.gz
| Download URL | adb_qr-0.1.0.tar.gz |
|---|---|
| Size | 111.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6098e2f4f22e7590dd57b506aa05d8e2b0512c83532132c76d19527e5a4ee9f8
|
|
BLAKE2b-256 checksum How to use checksums |
ed70de701e46444f9f78c93c6b12c84c6cf6cfdb3d237b7e28a357aefa58582a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / adb_qr-0.1.0-py3-none-any.whl
| Download URL | adb_qr-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9b744ae4173b2ed989898f909687c8521d0455b80be59220ef4bdf2755d26662
|
|
BLAKE2b-256 checksum How to use checksums |
3dcdde9291d7900402c4553e8eceed4b25640442b4d747bb18a32af41609bd4e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|