android-emulator: api36-v3 — avdmanager must run from inside the SDK root
v2's marker fix proved the install completes, but avdmanager still saw no system images: it IGNORES ANDROID_SDK_ROOT (and has no --sdk_root), deriving the SDK root from its own toolsdir — /opt/android in our image, while packages live on the PVC at /sdk. v3 seeds cmdline-tools into /sdk/cmdline-tools/latest once and runs avdmanager from there, so it resolves the PVC as the SDK root.
This commit is contained in:
parent
5e8a988858
commit
85dbec6108
3 changed files with 14 additions and 5 deletions
|
|
@ -4,8 +4,8 @@
|
|||
# cmdline-tools and the native libraries the emulator needs at runtime.
|
||||
#
|
||||
# Rebuild + push (rare — only when tool/library versions bump):
|
||||
# docker build -t forgejo.viktorbarzin.me/viktor/android-emulator:api36-v2 .
|
||||
# docker push forgejo.viktorbarzin.me/viktor/android-emulator:api36-v2
|
||||
# docker build -t forgejo.viktorbarzin.me/viktor/android-emulator:api36-v3 .
|
||||
# docker push forgejo.viktorbarzin.me/viktor/android-emulator:api36-v3
|
||||
FROM eclipse-temurin:17-jdk-jammy
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
|
|
|||
|
|
@ -40,9 +40,18 @@ if [ ! -f "$MARKER" ]; then
|
|||
fi
|
||||
|
||||
# --- AVD (idempotent) --------------------------------------------------------
|
||||
if ! avdmanager list avd -c | grep -qx "$AVD_NAME"; then
|
||||
# avdmanager IGNORES ANDROID_SDK_ROOT (and has no --sdk_root): it derives the
|
||||
# SDK root from its own toolsdir. Run it from a copy of cmdline-tools seeded
|
||||
# INSIDE /sdk so it resolves the PVC as the root — otherwise it looks under
|
||||
# /opt/android and reports "Valid system image paths are: null".
|
||||
if [ ! -x /sdk/cmdline-tools/latest/bin/avdmanager ]; then
|
||||
mkdir -p /sdk/cmdline-tools
|
||||
cp -a /opt/android/cmdline-tools/latest /sdk/cmdline-tools/latest
|
||||
fi
|
||||
AVDMANAGER=/sdk/cmdline-tools/latest/bin/avdmanager
|
||||
if ! "$AVDMANAGER" list avd -c | grep -qx "$AVD_NAME"; then
|
||||
echo "Creating AVD '$AVD_NAME' (${SYSTEM_IMAGE}, pixel_7)..."
|
||||
(echo no || true) | avdmanager create avd -n "$AVD_NAME" -k "$SYSTEM_IMAGE" --device pixel_7
|
||||
(echo no || true) | "$AVDMANAGER" create avd -n "$AVD_NAME" -k "$SYSTEM_IMAGE" --device pixel_7
|
||||
cat >> "${ANDROID_AVD_HOME}/${AVD_NAME}.avd/config.ini" <<EOF
|
||||
hw.ramSize=${EMULATOR_RAM_MB}
|
||||
disk.dataPartition.size=8192M
|
||||
|
|
|
|||
|
|
@ -5,6 +5,6 @@ variable "tls_secret_name" {
|
|||
|
||||
variable "image_tag" {
|
||||
type = string
|
||||
default = "api36-v2"
|
||||
default = "api36-v3"
|
||||
description = "android-emulator image tag at forgejo.viktorbarzin.me/viktor/android-emulator. Built + pushed manually from stacks/android-emulator/docker/ (see README.md) — bump this when the image is rebuilt."
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue