t3code icon indicating copy to clipboard operation
t3code copied to clipboard

[Bug]: A failing `avdmanager list avd` (no Java runtime found) hides physical Android devices from device_list

Open never102 opened this issue 1 week ago • 0 comments

Before submitting

  • [X] I searched existing issues and did not find a duplicate.
  • [X] I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

  1. On a macOS host, install the Android SDK through Android Studio at ~/Library/Android/sdk (platform-tools, emulator, cmdline-tools/latest). Have no JDK that /usr/libexec/java_home can find. Android Studio's bundled JBR and a JDK set with flutter config --jdk-dir don't count, and Flutter and Gradle builds still work on such a machine.
  2. Plug in a physical Android device with USB debugging on. adb devices -l lists it as device.
  3. Call device_list, or open the Devices tab.

Expected behavior

The physical device is listed with physical: true. An AVD listing failure only affects emulators, so it should show in the host status without hiding adb-attached devices. Better still, the hub could run avdmanager with a JAVA_HOME it can find (Android Studio's JBR) when the system has none.

Actual behavior

Android is reported available, the host status detail reads:

[android-utils] Failed to run `avdmanager list avd`: Error: Command failed: ~/Library/Android/sdk/cmdline-tools/latest/bin/avdmanager list avd ~/Library/Android/sdk/cmdline-tools/latest/bin/avdmanager: line 173: test: : integer expression expected The operation couldn’t be completed. Unable to locate a Java Runtime.

and no Android device is listed, so the physical device is missing. Agents can't reach it through the device tools, and the device instructions forbid adb (#38920 covers that side), so delegated agents stop.

Workaround: link a JDK where macOS looks for one, e.g. ln -s <jdk-bundle> ~/Library/Java/JavaVirtualMachines/<name>.jdk. After that avdmanager list avd succeeds and the next device_list shows the device with physical: true.

Impact

Blocks work completely

Version

0.1.11-nightly.20261118.4903 (device hub 0.22.1)

Environment

macOS (Darwin 27.0.0) arm64; Android 15 tablet over USB through a hub. Related: #20909, #17904.

never102 avatar Nov 19 '26 04:11 never102