emu: prefer the working host SDK over the broken home install

The emulator in ~/Android/Sdk auto-updated to 37.2.12 on Oct 11 and since
then consistently fails its own KVM probe ("/dev/kvm is not found") and
segfaults on that failure path — while KVM is healthy: a manual
KVM_GET_API_VERSION ioctl returns the current API level 12, and both
/opt/android-sdk and the container-home emulator pass -accel-check on
the same kernel and device node. The script now prefers the documented
host SDK at /opt/android-sdk when no ANDROID_SDK_ROOT is set.

Once the home SDK is repaired (or the emulator regression disappears),
the fallback order can be revisited.
This commit is contained in:
Jeena 2026-10-19 13:38:52 +00:00
parent 35e0f31a74
commit e7b15f819e

View file

@ -15,6 +15,14 @@
set -euo pipefail set -euo pipefail
SDK="${ANDROID_SDK_ROOT:-$HOME/Android/Sdk}" SDK="${ANDROID_SDK_ROOT:-$HOME/Android/Sdk}"
# Prefer the working host SDK at /opt/android-sdk: the emulator that
# ~/Android/Sdk auto-updated to on Oct 11 (37.2.12) fails its own KVM probe
# ("/dev/kvm is not found") with KVM perfectly healthy — /opt/android-sdk and
# the container-home copy both pass -accel-check on the same kernel, so that
# install is broken. /opt/android-sdk is the documented host SDK anyway.
if [ -z "${ANDROID_SDK_ROOT:-}" ] && [ -x /opt/android-sdk/emulator/emulator ]; then
SDK=/opt/android-sdk
fi
EMU="$SDK/emulator/emulator" EMU="$SDK/emulator/emulator"
ADB="$SDK/platform-tools/adb" ADB="$SDK/platform-tools/adb"
SDKM="$SDK/cmdline-tools/latest/bin/sdkmanager" SDKM="$SDK/cmdline-tools/latest/bin/sdkmanager"