Skip to content

Commit df7a91f

Browse files
committed
Auto merge of #59770 - pietroalbini:pin-android-emulator, r=kennytm
ci: pin android emulator to 28.0.23 Apparently Android Emulator 28.0.25 (the latest one) is broken for us, and `sdkmanager` doesn't have a way to pin a package to a specific version. This PR stops downloading the emulator from `sdkmanager`, downloading it manually instead. Tested this locally and confirmed it works. I'll open an issue on Google's issue tracker later today. Fixes #59757 r? @kennytm
2 parents 4fb888b + d13547a commit df7a91f

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

src/ci/docker/arm-android/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ RUN dpkg --add-architecture i386 && \
2323

2424
COPY scripts/android-sdk.sh /scripts/
2525
RUN . /scripts/android-sdk.sh && \
26-
download_and_create_avd 4333796 armeabi-v7a 18
26+
download_and_create_avd 4333796 armeabi-v7a 18 5264690
2727

2828
ENV PATH=$PATH:/android/sdk/emulator
2929
ENV PATH=$PATH:/android/sdk/tools

src/ci/docker/scripts/android-sdk.sh

+14-2
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,19 @@ download_sysimage() {
2020
# The output from sdkmanager is so noisy that it will occupy all of the 4 MB
2121
# log extremely quickly. Thus we must silence all output.
2222
yes | sdkmanager --licenses > /dev/null
23-
yes | sdkmanager platform-tools emulator \
23+
yes | sdkmanager platform-tools \
2424
"platforms;android-$api" \
2525
"system-images;android-$api;default;$abi" > /dev/null
2626
}
2727

28+
download_emulator() {
29+
# Download a pinned version of the emulator since upgrades can cause issues
30+
curl -fo emulator.zip "https://dl.google.com/android/repository/emulator-linux-$1.zip"
31+
rm -rf "${ANDROID_HOME}/emulator"
32+
unzip -q emulator.zip -d "${ANDROID_HOME}"
33+
rm -f emulator.zip
34+
}
35+
2836
create_avd() {
2937
abi=$1
3038
api=$2
@@ -40,11 +48,12 @@ download_and_create_avd() {
4048
download_sdk $1
4149
download_sysimage $2 $3
4250
create_avd $2 $3
51+
download_emulator $4
4352
}
4453

4554
# Usage:
4655
#
47-
# setup_android_sdk 4333796 armeabi-v7a 18
56+
# download_and_create_avd 4333796 armeabi-v7a 18 5264690
4857
#
4958
# 4333796 =>
5059
# SDK tool version.
@@ -53,3 +62,6 @@ download_and_create_avd() {
5362
# System image ABI
5463
# 18 =>
5564
# Android API Level (18 = Android 4.3 = Jelly Bean MR2)
65+
# 5264690 =>
66+
# Android Emulator version.
67+
# Copy from the "build_id" in the `/android/sdk/emulator/emulator -version` output

0 commit comments

Comments
 (0)