connecting-to-devices

Resolve ambiguous Android ADB device selection and waiting states.

303|10|Updated May 15, 2026
One-click install
npx skills add https://github.com/skydoves/android-testing-skills --skill connecting-to-devices
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: connecting-to-devices
Source: https://github.com/skydoves/android-testing-skills/tree/main/adb/devices/connecting-to-devices
Command: npx skills add https://github.com/skydoves/android-testing-skills --skill connecting-to-devices

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill solves flaky Android testing setup caused by ambiguous ADB device selection, incorrect transport targeting, and timing issues where scripts run before the device is fully ready.

Core Features & Use Cases

  • Deterministic device discovery: Guides how to interpret adb devices / adb devices -l output, including states like device, offline, unauthorized, and Linux-only no permissions.
  • Correct transport targeting: Shows when to use -s SERIAL, -d, -e, or -t TRANSPORT_ID to avoid “more than one device/emulator” failures and to select the intended transport reliably.
  • Canonical waiting flow: Uses adb wait-for[-TRANSPORT]-STATE with the correct allowed STATE values, then recommends polling sys.boot_completed when boot completion is required for actions like install and instrumentation.

Quick Start

Use the connecting-to-devices skill to write a CI script that lists ADB transports, selects the intended one, waits for it to reach state device, then blocks until sys.boot_completed becomes 1 before starting tests.

Frequently Asked Questions about connecting-to-devices

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why does my ADB command fail with more than one device/emulator error?

ADB commands fail with multiple devices when no transport is specified. Use adb devices -l to list transports, then target your intended device using -s SERIAL, -d for USB, -e for emulator, or -t TRANSPORT_ID to resolve the ambiguity.

How do I wait for an Android device to fully boot before running tests?

To wait for a full Android boot, first use adb wait-for-device to block until the transport connects, then poll getprop sys.boot_completed until it returns 1, ensuring the OS is fully ready for test instrumentation.

How do I fix ADB devices showing unauthorized or no permissions on Linux?

Unauthorized or no permissions states in adb devices output indicate missing authorization or udev rules. Check adb devices -l output for these states and configure udev rules to grant the necessary USB permissions for the connected transport.

What is the correct syntax for adb wait-for to target a specific device state?

The canonical adb wait-for syntax is adb wait-for[-TRANSPORT]-STATE, where STATE corresponds to values like device, offline, or unauthorized. Specifying the transport and state ensures scripts block until the intended target reaches the required condition.

How do I select a specific Android emulator transport when multiple are running?

To select a specific emulator when multiple transports are active, run adb devices -l to identify available emulators, then use the -e flag for the emulator or -t TRANSPORT_ID to ensure commands route to the correct virtual device.

Can I use adb wait-for-device for wireless or TCP Android connections?

Yes, adb wait-for-device applies to wireless and TCP connections. List transports with adb devices, select the networked device using -s SERIAL or -t TRANSPORT_ID, and apply the canonical wait-for syntax to block until the wireless transport reaches the device state.