Pair Android devices for wireless ADB by QR code -- discovery via adb's own mDNS, so it works even in WSL2, containers and VMs
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file adb_qr-0.1.0.tar.gz.
File metadata
- Download URL: adb_qr-0.1.0.tar.gz
- Upload date:
- Size: 111.7 kB
- Tags: Source
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6098e2f4f22e7590dd57b506aa05d8e2b0512c83532132c76d19527e5a4ee9f8
|
|
| MD5 |
9935eed74afe3d0deb908cab1292841b
|
|
| BLAKE2b-256 |
ed70de701e46444f9f78c93c6b12c84c6cf6cfdb3d237b7e28a357aefa58582a
|
File details
Details for the file adb_qr-0.1.0-py3-none-any.whl.
File metadata
- Download URL: adb_qr-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.8 kB
- Tags: Python 3
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b744ae4173b2ed989898f909687c8521d0455b80be59220ef4bdf2755d26662
|
|
| MD5 |
bd5c9bf35071163bdc587bad7fe87c5d
|
|
| BLAKE2b-256 |
3dcdde9291d7900402c4553e8eceed4b25640442b4d747bb18a32af41609bd4e
|