Skip to content

Commit 0cb070f

Browse files
committed
fix: dynamically fetch latest emulator from SDK repository XML
1 parent 3233a5b commit 0cb070f

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

Dockerfile

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,12 @@ RUN apt-get update && \
2121
apt-get clean && \
2222
rm -rf /var/lib/apt/lists/*
2323

24-
# Download emulator directly as fallback (sdkmanager doesn't always provide it)
25-
RUN mkdir -p /opt/android-sdk && \
26-
cd /opt/android-sdk && \
27-
wget -q "https://dl.google.com/android/repository/emulator-linux_x64-11076708_latest.zip" -O emulator.zip || true && \
28-
if [ -f emulator.zip ]; then \
29-
unzip -q emulator.zip && rm emulator.zip; \
30-
else \
31-
echo "Warning: Failed to download emulator, will install via sdkmanager"; \
24+
RUN curl -s "https://dl.google.com/android/repository/repository2-1.xml" | \
25+
grep -oP 'emulator-linux_x64-\d+\.zip' | head -1 | \
26+
awk '{print "https://dl.google.com/android/repository/" $0}' | \
27+
wget -q -O /tmp/emulator.zip - || true && \
28+
if [ -s /tmp/emulator.zip ] && [ -f /tmp/emulator.zip ]; then \
29+
unzip -q /tmp/emulator.zip -d /opt/android-sdk && rm /tmp/emulator.zip; \
3230
fi
3331

3432
# Set up Android SDK

0 commit comments

Comments
 (0)