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
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue