On my MacBook (Sonoma 14.6.1) I have adb installed (using homebrew - version 35.0.2-12147458). It works well until I activate VPN. My company uses Cisco AnyConnect. Once VPN is enabled, I am getting this:
> adb start-server
* daemon not running; starting now at tcp:5037
ADB server didn't ACK
Full server startup log: /var/folders/96/g55p8hzj7wx9pl5y2qypzjcw0000gp/T//adb.502.log
Server had pid: 80435
--- adb starting (pid 80435) ---
09-10 10:47:12.397 80435 47875737 I adb : main.cpp:63 Android Debug Bridge version 1.0.41
09-10 10:47:12.397 80435 47875737 I adb : main.cpp:63 Version 35.0.2-12147458
09-10 10:47:12.397 80435 47875737 I adb : main.cpp:63 Installed as /opt/homebrew/bin/adb
09-10 10:47:12.397 80435 47875737 I adb : main.cpp:63 Running on Darwin 23.6.0 (arm64)
09-10 10:47:12.397 80435 47875737 I adb : main.cpp:63
09-10 10:47:12.406 80435 47875737 I adb : auth.cpp:416 adb_auth_init...
09-10 10:47:12.407 80435 47875737 I adb : auth.cpp:152 loaded new key from '/Users/anton.avtamonov/.android/adbkey' with fingerprint 2D331848B6E6BE21327954C681930EEF0EFD536A0B8A9C5197F7567428D36020
09-10 10:47:12.408 80435 47875737 I adb : udp_socket.cpp:170 AdbUdpSocket fd=10
09-10 10:47:12.408 80435 47875737 I adb : udp_socket.cpp:170 AdbUdpSocket fd=8
09-10 10:47:12.408 80435 47875737 I adb : udp_socket.cpp:274 SetMulticastOutboundInterface for index=14
09-10 10:47:12.408 80435 47875737 I adb : udp_socket.cpp:533 bind endpoint=0.0.0.0:5353
09-10 10:47:12.408 80435 47875737 I adb : udp_socket.cpp:274 SetMulticastOutboundInterface for index=14
09-10 10:47:12.408 80435 47875737 I adb : udp_socket.cpp:558 bind endpoint=[0000:0000:0000:0000:0000:0000:0000:0000]:5353 scope_id=0
09-10 10:47:12.408 80435 47875737 I adb : udp_socket.cpp:170 AdbUdpSocket fd=12
09-10 10:47:12.408 80435 47875737 I adb : udp_socket.cpp:274 SetMulticastOutboundInterface for index=15
09-10 10:47:12.408 80435 47875737 I adb : udp_socket.cpp:558 bind endpoint=[0000:0000:0000:0000:0000:0000:0000:0000]:5353 scope_id=0
09-10 10:47:12.473 80435 47875737 F adb : udp_socket.cpp:447 Check failed: static_cast<size_t>(num_bytes_sent) == length (static_cast<size_t>(num_bytes_sent)=12, length=33)
* failed to start daemon
error: cannot connect to daemon
I suspect that it is because the VPN impede udp traffic in some way, but I am not sure. It can also be that VPN uses 0.0.0.0 as the default route that somehow affects adb's ability to send a test datagram.
I tried to first start the adb server and then connect to VPN. That seems to work or at least I can do 'adb connect' after re-enabling VPN and it does not fail. I do not know how adb uses udp and multicast and how critical this all is for its operations.
The question is if there is a way to tell adb to bind to only ipv4 and maybe specify the interface to bind. Or whatever else that you can suggest. Adb is used by millions and Cisco Anyconnect is not that rare either. I cannot believe I am the only one that is facing this issue, but I did not find anything... This is not specific to my computer - this is not working the same way for everybody in our group.
Same issue with Cloudflare WARP October release. After driving me nuts during deadline crunch time, this worked:
ADB_MDNS_OPENSCREEN=0 adb start-server