-
-
Notifications
You must be signed in to change notification settings - Fork 8
Description
https://github.com/skiptools/skipstone/actions/runs/22827276828/job/66210543724#step:17:1117
avdmanager list avd is showing:
executing command: /usr/local/lib/android/sdk/cmdline-tools/latest/bin/avdmanager list avd
Available Android Virtual Devices:
Name: emulator-34-medium_phone
Device: medium_phone (Generic)
Path: /home/runner/.config/.android/avd/emulator-34-medium_phone.avd
Target: Google APIs (Google Inc.)
Based on: Android 14.0 ("UpsideDownCake") Tag/ABI: google_apis/x86_64
Sdcard: 512 MB
That's $HOME/.config/.android/avd, which is in the XDG_CONFIG_HOME under the XDG Base Directory Specification.
The problem is, the latest version of emulator doesn't actually check there! When you try to launch an unknown emulator, emulator says:
(Note: Directories are searched in the order $ANDROID_AVD_HOME, $ANDROID_SDK_HOME/avd and $HOME/.android/avd)
That feels like a bug in emulator; it should at least try to check the default directory that avdmanager uses.
It seems like Google sanitizes this by adding environment variables like these: https://android.googlesource.com/platform/tools/base/+/mirror-goog-studio-main/bazel/avd/emulator_launcher.sh.template#109
export ANDROID_USER_HOME=$HOME/.android
export ANDROID_EMULATOR_HOME=$ANDROID_USER_HOME
export ANDROID_AVD_HOME=$ANDROID_EMULATOR_HOME/avd
I believe that will make avdmanager and emulator agree on ~/.android as the AVD directory. (I think only ANDROID_AVD_HOME actually matters, but I'm not too sure about that.)
That raises questions about how/where we want to use that information.
- We could try to set
ANDROID_AVD_HOMEourselves inAndroidCommand.swift(yielding to the user's environment if they've set it)- We could set it to the XDG dir
~/.config/.android/avd. (Presumably we'd only do that on Linux…?) - Or we could set it to
~/.android/avd(on all platforms…?)
- We could set it to the XDG dir
- We could just set environment variables ourselves in
ci.yml(and let end users do the same)
@marcprux Do you have any intuition on what would be best here?
Originally posted by @dfabulich in #203 (comment)