Why 'adb devices' Hangs for Minutes on Windows: The Unexpected Apple Bonjour Conflict
While debugging Android applications on Windows recently, I noticed that running adb devices would frequently hang for an uncomfortably long time—sometimes a few seconds, other times stretching into several minutes.
At first, I assumed it was network instability with Wi-Fi ADB. But switching to a physical USB-C cable didn’t help at all.
Eventually, I noticed something telling: running adb devices with no devices or emulators connected at all still hung. That meant the issue had nothing to do with the target phone or the cable—it was happening entirely during the ADB Server startup phase.
The surprising culprit? Apple’s Bonjour service installed in the background on Windows.
🔬 Troubleshooting Process
1. Verify the Baseline Environment
Start by checking the active ADB version, binary paths, and running process state:
1 | adb version |
Result: Only a single ADB process was active, correctly listening on the standard port 5037. This ruled out a common multi-version ADB conflict (frequently triggered when Android emulators like NoxPlayer or LDPlayer bundle their own outdated ADB binaries that fight over port 5037).
No overriding ADB_* environment variables were set either.
2. Measure Server Startup Time
Kill the server and measure cold start responsiveness:
1 | adb kill-server |
Finding: When the ADB server was already warm and running, queries returned almost instantaneously. The freeze only occurred during a cold server start. However, restarting alone manually sometimes took only ~2 seconds, confirming this was an intermittent, state-dependent hang.
3. Check UDP Port 5353 (mDNS Discovery)
Modern versions of ADB (platform-tools 31.0.0+) perform mDNS-based device discovery when the server launches, enabling wireless debugging pairing on Android 11+. This requires binding UDP port 5353.
Let’s see who holds that port:
1 | netstat -ano -p udp | findstr 5353 |
Besides ADB itself, another background service was bound to it: PID 4968, which resolved to mDNSResponder:
1 | C:\Program Files\Bonjour\mDNSResponder.exe |
That is Apple’s Bonjour service (often silently installed alongside iTunes, iCloud, or developer toolchains). Additionally, Windows’ native Dnscache service (svchost) was also attached to port 5353.
4. Verify the Hypothesis
After uninstalling the Bonjour service:
1 | winget uninstall --id Apple.Bonjour |
I restarted the ADB server with mDNS left on by default. Cold startup times immediately stabilized around 2 seconds. Over the subsequent weeks of daily development, adb devices never hung or froze again.
💥 Root Cause Analysis
- When the ADB Server initializes, it sets up its mDNS backend—binding UDP port 5353 and broadcasting multicast queries.
- On Windows, UDP 5353 is the designated standard mDNS port. While multiple processes can technically bind to it simultaneously via
SO_REUSEADDR, having a residentmDNSResponder(Bonjour) actively running can cause ADB’s discovery socket to block under certain network topologies (e.g., multiple network adapters, virtual VPN interfaces, or aggressive firewall rules dropping multicast replies). - Because packet drops and socket timeouts vary with firewall policies and network status, the hang manifested intermittently—making it deceptive and easy to misattribute to faulty USB cables or flaky Wi-Fi connections.
🛠️ Solutions
Approach 1: Uninstall Bonjour (Recommended if Unused)
If you don’t actively rely on iTunes sync or Apple AirPrint services on Windows, simply remove the Bonjour runtime:
1 | winget uninstall --id Apple.Bonjour |
Approach 2: Disable ADB’s mDNS Subsystem
If you must keep Bonjour for other audio or printer workflows, you can tell ADB to skip mDNS initialization entirely. This keeps USB debugging and manual adb connect <ip>:<port> working 100% normally, with the only tradeoff being the loss of automatic wireless pairing discovery:
1 | # Set per-user environment variable |
After modifying your environment or uninstalling, restart the ADB daemon:
1 | adb kill-server && adb devices |
📋 Takeaways
- Rule out the device early: When
adb deviceshangs even when nothing is plugged in, focus on the server bootstrap phase, not the device, cable, or driver. - The three most common ADB freezes on Windows:
- mDNS UDP 5353 conflicts (Bonjour / third-party multicast daemons)
- Port 5037 contention between conflicting ADB binary versions
- Antivirus or firewall suites blocking localhost socket communication
- Keep diagnostic commands handy:
netstat -ano -p udp | findstr 5353Get-CimInstance Win32_Process -Filter "Name='adb.exe'"Measure-Command { adb devices }
Environment: Windows 11 / Android SDK Platform-Tools 36.0.0 / Apple Bonjour 3.1.0.1