Skip to content

Local device host stops Android SDK detection when ANDROID_HOME points at a directory that is not an SDK #38268

Closed

Description

@Twarug

What happened

With ANDROID_HOME set to the parent of the real SDK directory (<parent> instead of <parent>/sdk), the Device panel reported "Android SDK Platform-Tools are missing from <parent>", and Android was unavailable. The real SDK was at <parent>/sdk, and its platform-tools was on PATH. T3 never tried ANDROID_SDK_ROOT, the default locations, or adb on PATH.

Diagnosis

apps/server/src/device/LocalDeviceHost.ts (v0.1.10, unchanged on main), androidSdk:

const explicit = environment.ANDROID_HOME?.trim() || environment.ANDROID_SDK_ROOT?.trim();
...
if (!explicit && !adb && !emulator) return null;   // inspect() accepts any explicit root
...
const candidates = explicit ? [explicit] : [ ...default locations ];
...
if (!explicit) { /* PATH adb lookup */ }
  1. When either env var is set, it is the only candidate. ANDROID_SDK_ROOT is ignored whenever ANDROID_HOME is non-empty.
  2. inspect returns a result for an explicit root even when it has neither adb nor emulator, so detection stops there.
  3. The default locations and the PATH lookup are both skipped while an explicit value exists.

platformReason then reports Platform-Tools as missing from the wrong root. deviceHostEnvironment also exports that wrong root as ANDROID_HOME to the device hub.

The repo already handles this case the right way elsewhere: scripts/mobile-native-client.ts androidSdk walks [ANDROID_HOME, ANDROID_SDK_ROOT, ...defaults] and takes the first one that has platform-tools.

Steps to reproduce

  1. Install an Android SDK at <parent>/sdk (with platform-tools, emulator, and cmdline-tools/latest).
  2. Set ANDROID_HOME=<parent> (a directory that is not the SDK root), and put <parent>/sdk/platform-tools on PATH.
  3. Start the T3 Code desktop app and open the Device panel (or call device_list).
  4. Android is unavailable: "Android SDK Platform-Tools are missing from <parent>. Install them in Android Studio's SDK Manager."

Expected: T3 tries the candidates in order (ANDROID_HOME, ANDROID_SDK_ROOT, default locations, adb/emulator on PATH) and uses the first root that has adb or emulator. It reports a missing-component reason only when no candidate qualifies. That reason could name the explicit root, plus a note that the env var looks wrong.

Optional: an Android SDK path setting in the app, so users don't depend on login-shell env vars for the desktop app.

Version

T3 Code 0.1.10 (desktop app; local server reports serverVersion 0.1.10). Triage CLI: 0.1.10.

Environment

Linux x64 (CachyOS, kernel 7.3.4), desktop app (AUR-style install under /opt/t3code-bin), local server, Node v26.13.1.

Evidence

- User-reported message: `Android SDK Platform-Tools are missing from <parent>`.
- Source: `apps/server/src/device/LocalDeviceHost.ts` lines 129–176 at tag v0.1.10. `main` has the same logic (`explicit ? [explicit] : …`, `if (!explicit) { PATH lookup }`).
- After `ANDROID_HOME` was corrected to the SDK dir, the running server's env has `ANDROID_HOME` = `ANDROID_SDK_ROOT` = the real SDK. That SDK contains `platform-tools/adb`, `emulator/emulator`, and `cmdline-tools/latest/bin/avdmanager`.

Related issues

Fix applied or workaround

Workaround: set ANDROID_HOME (and/or ANDROID_SDK_ROOT) to the actual SDK directory, then restart the desktop app. Or unset both and let auto-detection find adb on PATH.

Filed by

Triaged with Claude Code (Claude Opus 5.5, claude-opus-5-5) via t3 triage

Activity

  1. added
    via-triage
    on Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    via-triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions