Repository navigation
fix(emulator): detect Android devices when only adb is installed - #37128
Conversation
SDK discovery required both adb and the emulator binary under an SDK root, so hosts with platform-tools only, or a standalone adb such as a distro android-tools package, saw no Android devices at all. Discovery now needs only adb, falls back to adb on PATH, and AVD listing and boot are skipped when the emulator package is missing. Fixes #32126 Co-authored-by: s546126 <[email protected]>
|
No actionable comments were generated in the recent review.
|
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

Minor · Update the missing-ADB guidance. · orca-emulator-android.md:47-48
skill-guides/orca-emulator-android.md:47-48
Minor · Functional Correctness · Quick win Update the missing-ADB guidance.
When no SDK-root ADB or PATH ADB is found, the guide and
androidSdkMissingstill tell users to install Android Studio and setANDROID_HOME. A standalone ADB now satisfies the prerequisite. Tell users to install ADB or configure an SDK path, and update the runtime message as well as the guide. (raw.githubusercontent.com)

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
a3db7a1a-2361-488d-aa26-1818ae3ce5ce
Files selected for processing: 14-
skill-guides/orca-emulator-android.mdsrc/cli/bundled-skill-guides.tssrc/main/emulator/android/android-avd-boot-identity.test.tssrc/main/emulator/android/android-avd-boot.tssrc/main/emulator/android/android-capability-operations.test.tssrc/main/emulator/android/android-device-inventory.test.tssrc/main/emulator/android/android-device-inventory.tssrc/main/emulator/android/android-input-commands.test.tssrc/main/emulator/android/android-sdk-discovery.test.tssrc/main/emulator/android/android-sdk-discovery.tssrc/main/emulator/android/android-sdk-host-discovery.tssrc/main/emulator/android/scrcpy-stream-session.test.tssrc/main/emulator/backends/android-emulator-backend.test.tssrc/main/emulator/backends/android-emulator-backend.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.
-
| } | ||
| const rootsWithAdb = candidateSdkRoots(env, platform, homedir) | ||
| .map((sdkRoot) => resolveToolPaths(sdkRoot, win32)) | ||
| .filter((paths) => exists(paths.adb)) |
There was a problem hiding this comment.
Require a runnable SDK-root ADB before selecting it.
If platform-tools/adb exists but is not executable, this filter selects it and skips a runnable adb on PATH. Host discovery supplies existsSync, while the PATH resolver checks whether its result is runnable. The selected ADB then cannot list the connected device. Check SDK-root ADB candidates for executability before applying the documented fallback. (raw.githubusercontent.com)
…blyai#37128) * fix(emulator): detect Android devices with only adb installed SDK discovery required both adb and the emulator binary under an SDK root, so hosts with platform-tools only, or a standalone adb such as a distro android-tools package, saw no Android devices at all. Discovery now needs only adb, falls back to adb on PATH, and AVD listing and boot are skipped when the emulator package is missing. Fixes stablyai#32126 Co-authored-by: s546126 <[email protected]> * test(emulator): drop type assertion in adb-only inventory test --------- Co-authored-by: s546126 <[email protected]>
…blyai#37128) * fix(emulator): detect Android devices with only adb installed SDK discovery required both adb and the emulator binary under an SDK root, so hosts with platform-tools only, or a standalone adb such as a distro android-tools package, saw no Android devices at all. Discovery now needs only adb, falls back to adb on PATH, and AVD listing and boot are skipped when the emulator package is missing. Fixes stablyai#32126 Co-authored-by: s546126 <[email protected]> * test(emulator): drop type assertion in adb-only inventory test --------- Co-authored-by: s546126 <[email protected]>
…blyai#37128) * fix(emulator): detect Android devices with only adb installed SDK discovery required both adb and the emulator binary under an SDK root, so hosts with platform-tools only, or a standalone adb such as a distro android-tools package, saw no Android devices at all. Discovery now needs only adb, falls back to adb on PATH, and AVD listing and boot are skipped when the emulator package is missing. Fixes stablyai#32126 Co-authored-by: s546126 <[email protected]> * test(emulator): drop type assertion in adb-only inventory test --------- Co-authored-by: s546126 <[email protected]>
ELI5
If you only installed
adb(for example from your Linux distro'sandroid-toolspackage or Homebrew) and not Android Studio's emulator, Orca didn't see your phone at all, even thoughadb deviceslisted it. Now it does.What Changed
Before: the Mobile Emulator device list was empty and showed "No emulator devices found" on any host without the SDK
emulatorpackage, and a standaloneadbonPATHwas never looked at.After: USB devices show up as long as Orca can find
adb. AVDs still appear and boot when the emulator package is installed. Without it, only running devices are listed, and attaching a stopped AVD by name fails with the usual "not a running device or a known AVD" error instead of starting a missing binary.How it works:
discoverAndroidSdkneeds onlyadb. It still prefers an SDK root that also hasemulator(same pick as before for full SDKs), then an SDK root with platform-tools only, thenadbonPATHthrough the sharedresolveExecutableCommand.AndroidSdkPaths.emulatorandsdkRootcan be null.listAvdNamesskipsemulator -list-avdswhen there's no emulator, and AVD boot refuses before launching.adbpath under "Detected at" when there's no SDK root.avdmanagerpath and updated the Android emulator skill guide's prerequisites.Why
Root cause:
android-sdk-discovery.tsreturned a result only when an SDK root had bothadbandemulator. Every Android feature depends on that result, so hosts with onlyadblost physical devices, which never needed the emulator binary.Supersedes #9950 only for the SDK discovery part. That PR adds ADB network connections across 52 files, has merge conflicts, and makes the emulator optional without adding the
PATHlookup this issue needs. This PR is the small change that fixes the root cause on its own, and it credits the shared idea withCo-authored-by.Linked Issue
Fixes #32126
Visual Proof
N/A. The Settings screens are unchanged; the difference is whether a device appears. CLI evidence from a real macOS host with no SDK root, using
HOME=<empty dir>,PATH=/opt/homebrew/bin:/usr/bin:/bin, and a running emulator visible to Homebrewadb:discoverAndroidSdkFromHost()returnsnull, so no devices.{ sdkRoot: null, adb: '/opt/homebrew/bin/adb', emulator: null }, andlistAndroidDevicesreturns the bootedemulator-5554.~/Library/Android/sdk: the same root as before, with the running device and shutdown AVDs listed.Testing
On macOS I ran discovery and the device list against real
adb, before and after, as described above. The discovery tests cover an adb-only SDK root, a full SDK preferred over an earlier adb-only root, and thePATHfallback. An inventory test checks that onlyadbruns on an adb-only host. Allsrc/main/emulatortests pass (33 files). Changed-file oxlint, oxfmt, a scoped typecheck, andverify:bundled-skill-guides/verify:skill-bundle-manifestpass. Not tested on a real Linux or Windows host. Paths usepath.join, and thePATHlookup uses the shared resolver, which handlesadb.exeand;on Windows.AI Disclosure
Review
review-loop round 1 was clean: Codex had no findings, and Claude raised three P3s that I left as is. One is an SDK root that has
emulatorbut noadbwhileadbcomes fromPATH. It's rare, and it didn't work before either. The other two are the copy of the stopped-AVD error and the Settings label showing theadbpath.Agent skill upstream boundary
Notes
orca serve: discovery runs on the host that runs the runtime, same as before.AndroidSdkPathsnever goes over RPC, so clients and hosts on different versions are unaffected.adb, thePATHscan adds a few synchronousstatcalls. It doesn't run on a polling path.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)