Loading...
Loading...
Use this skill to connect ADB to an Android 11+ device wirelessly with the modern `adb pair` flow (pairing code or QR via `Settings → Developer options → Wireless debugging`), then `adb connect <host:port>` and `adb disconnect`, plus mDNS auto-discovery via `adb mdns check` / `adb mdns services` and the `_adb-tls-pairing._tcp` / `_adb-tls-connect._tcp` service types. Covers the ADB v34+ default mDNS backend (Openscreen on Linux/Windows, not Bonjour as the public doc says), the legacy `adb tcpip <port>` + `adb connect` path that pre-dates pairing, security caveats (corporate Wi-Fi blocks p2p; flat LAN exposure), version requirements (Android 11/API 30 for phones, Android 13/API 33 for TV+Wear), and the `ADB_MDNS_OPENSCREEN` / `ADB_MDNS_AUTO_CONNECT` environment variables. Use when the user mentions `adb pair`, `adb connect`, "wireless debugging", "QR code pairing", `_adb-tls-connect`, "Openscreen vs Bonjour", `adb tcpip 5555`, or "device not connecting after pairing successfully".
npx skill4agent add skydoves/android-testing-skills connecting-over-wifiadb pairadb tcpipadb tcpipadb pairadb tcpip 5555 && adb connect 192.168.1.100:5555connection refusedadb mdns check../connecting-to-devices/SKILL.md../../architecture/understanding-adb-architecture/SKILL.md../../tests/running-instrumented-tests-via-adb/SKILL.md../../architecture/understanding-adb-architecture/SKILL.mdSettings → System → Developer options → Wireless debuggingadb pair"Android 11 (API level 30) and higher support deploying and debugging your app wirelessly from your workstation using Android Debug Bridge (adb). For example, you can deploy your debuggable app to multiple remote devices without ever needing to physically connect your device via USB."
Settings → Developer options → Wireless debuggingIP:PORTadb pair 192.168.1.42:42999
# Enter pairing code: 123456
# Successfully paired to 192.168.1.42:42999 [guid=adb-...-RQAZWM]IP:PORTadb connect 192.168.1.42:39555
adb devices
# 192.168.1.42:39555 deviceadb disconnect [<host:port>]adb mdns check
# mdns daemon version [openscreen discovery 0.0.0]
adb mdns services
# List of discovered mdns services
# adb-XXXXXXXX-RQAZWM _adb-tls-pairing._tcp 192.168.1.42:42999
# adb-XXXXXXXX-RQAZWM _adb-tls-connect._tcp 192.168.1.42:39555_adb._tcpadb tcpip_adb-tls-pairing._tcp_adb-tls-connect._tcpADB_MDNS_AUTO_CONNECT=adb-tls-connectADB_MDNS_OPENSCREEN=1 adb start-server # force Openscreen
ADB_MDNS_OPENSCREEN=0 adb start-server # force Bonjour../../architecture/understanding-adb-architecture/SKILL.mdADB_MDNS_AUTO_CONNECTADB_MDNS_OPENSCREENadb tcpip# 1. USB-attach the device, accept the RSA dialog, confirm with `adb devices`.
adb tcpip 5555
# 2. Unplug USB.
adb connect 192.168.1.42:55555555adb usbadb pair"Device not connecting after pairing successfully:relies on mDNS to discover and automatically connect to paired devices. If your network or device configuration does not support mDNS or has disabled it, then you need to manually connect to the device usingadb."adb connect ip:port
"Secure Wi-Fi networks, such as corporate Wi-Fi networks, may block p2p connections and not let you connect over Wi-Fi. Try connecting with a cable or another (non-corp) Wi-Fi network."
adb mdns checkadb connect <ip:port>connection refusedadb connect_adb-tls-connect._tcpadb mdns services"over Wi-Fi sometimes turns off automatically: This can happen if the device either switches Wi-Fi networks or disconnects from the network. To resolve, re-connect to the network."adb
adb tcpipadb pairadb tcpip# WRONG
adb tcpip 5555
adb connect 192.168.1.100:5555
# WRONG because: on Android 11+ the modern `adb pair` flow is available and
# encrypts/authenticates over TLS. The tcpip path bypasses pairing, exposes a
# well-known unauthenticated TCP listener until reboot, and is often blocked
# on managed Wi-Fi. Many corporate networks drop port 5555 traffic outright.# RIGHT
# On the device: Settings -> Developer options -> Wireless debugging -> ON
# Then "Pair device with pairing code" — note the displayed IP:PORT and code.
adb pair 192.168.1.100:42999
# Enter pairing code: 123456
# Then connect on the device's separate connect-port (also shown in Wireless debugging):
adb connect 192.168.1.100:39555
adb devices
# 192.168.1.100:39555 device# WRONG
adb pair 192.168.1.100:42999
# (succeeds)
adb connect 192.168.1.100:42999
# error: failed to connect to '192.168.1.100:42999': Connection refused
# WRONG because: the pairing port is one-shot. After successful pairing, the
# device exposes a different IP:PORT (the "Pair devices over Wi-Fi" main screen
# shows it under the device's IP). Trying to connect to the pairing port fails.# RIGHT
# Read the connect port from the Wireless debugging main screen (NOT the
# "Pair device with pairing code" dialog), or:
adb mdns services
# adb-... _adb-tls-connect._tcp 192.168.1.100:39555
adb connect 192.168.1.100:39555# WRONG (script makes assumptions about mdnsResponder / Bonjour being default)
# CI script greps for "bonjour" in `adb mdns check` output and aborts when it
# does not find it.
adb mdns check | grep -q bonjour || exit 1
# WRONG because: ADB v34+ defaults to the Openscreen backend on Linux/Windows.
# Output is "mdns daemon version [openscreen discovery 0.0.0]" on those hosts.
# The script breaks on every modern CI runner.# RIGHT
# Either accept either backend, or pin one with the env var:
ADB_MDNS_OPENSCREEN=1 adb start-server
adb mdns check # confirm "openscreen discovery"
# Or for environments that still need Bonjour:
ADB_MDNS_OPENSCREEN=0 adb start-serveradb pairadb connectadb tcpip_adb-tls-connect._tcpadb connectADB_MDNS_OPENSCREEN=0|1adb tcpip 5555adb mdns checkadb mdns servicesadb pair <host:port>Successfully paired to <host:port>adb connect <host:port>connected to <host:port>adb devicesdeviceadb mdns checkadb mdns services_adb-tls-connect._tcpadb devicesadb pairadb tcpipadb mdns checkadbtasks/research/A1-adb-architecture-devices.mddocs/CORPUS.md../../architecture/understanding-adb-architecture/SKILL.md../connecting-to-devices/SKILL.md../../apps/installing-and-managing-apps/SKILL.md../../tests/running-instrumented-tests-via-adb/SKILL.mdAndroidJUnit4../../../instrumentation/runner/running-instrumented-tests-with-androidjunit4/SKILL.md../../../jvm-tests/runner/configuring-junit4-on-android/SKILL.md../../../fundamentals/strategies/organizing-test-source-sets/SKILL.md