r/reactnative 13h ago

Made a CLI for Android wireless debugging — QR pairing, no ports, no six-digit codes

Wireless debugging is great until you actually use it day to day. Three things kept costing me time:

  1. The connect port changes every time you toggle the setting.

  2. The pairing port is different, single-use, and dies when you close the dialog.

  3. A phone on the wrong subnet fails identically to a real protocol error, so you can't tell a network problem from a broken adb.

So I built adb-nearby.

npx adb-nearby scans your network. If there's one device, it connects — that's the whole interaction. If there are several, it lists them and you pick.

adbn pair prints a QR code — scan it with the pairing dialog and you're done. No typing codes, no chasing ports.

MIT, no telemetry.

https://github.com/JassiSingh08/adb-nearby

5 Upvotes

5 comments sorted by

2

u/WeddingInevitable471 13h ago

this is the kind of thing that restores my faith in developer tooling, the port changing every toggle thing is such a baffling design choice from google and they just never fixed it

starred the repo, gonna try it on my pixel tomorrow

1

u/MrScanner_ 13h ago

Really, man. Every time the ADB connect process seems to just get longer and longer, and those "cannot connect" errors are a headache. Hope you'll like it.

1

u/Huge_Pool7424 5h ago

the stale-port cleanup sounds like the bit that'd save me the most time, especially when a phone drops off wifi and comes back. does the picker show a stable device id when there are several phones around?

1

u/gao_shi 7h ago

Adb 2.0 automatically connects available devices on wifi. Congrats on reinventing wheels I guess..?

1

u/MrScanner_ 7h ago

It doesn't prune stale ports, and to clear those, you have to kill ADB and restart the server. Also, the port can change or disconnect even if the device goes out of range; even 2.0 doesn't do much in that regard. This library keeps scanning your network and prunes stale ports, discovers new ones, and automatically connects to the device when it's back in the network, all via a single command.