Skip to content

Commit

Permalink
Auto merge of #59770 - pietroalbini:pin-android-emulator, r=kennytm
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bors committed Apr 7, 2019
2 parents 4fb888b + d13547a commit df7a91f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/ci/docker/arm-android/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ RUN dpkg --add-architecture i386 && \

COPY scripts/android-sdk.sh /scripts/
RUN . /scripts/android-sdk.sh && \
download_and_create_avd 4333796 armeabi-v7a 18
download_and_create_avd 4333796 armeabi-v7a 18 5264690

ENV PATH=$PATH:/android/sdk/emulator
ENV PATH=$PATH:/android/sdk/tools
Expand Down
16 changes: 14 additions & 2 deletions src/ci/docker/scripts/android-sdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,19 @@ download_sysimage() {
# The output from sdkmanager is so noisy that it will occupy all of the 4 MB
# log extremely quickly. Thus we must silence all output.
yes | sdkmanager --licenses > /dev/null
yes | sdkmanager platform-tools emulator \
yes | sdkmanager platform-tools \
"platforms;android-$api" \
"system-images;android-$api;default;$abi" > /dev/null
}

download_emulator() {
# Download a pinned version of the emulator since upgrades can cause issues
curl -fo emulator.zip "https://dl.google.com/android/repository/emulator-linux-$1.zip"
rm -rf "${ANDROID_HOME}/emulator"
unzip -q emulator.zip -d "${ANDROID_HOME}"
rm -f emulator.zip
}

create_avd() {
abi=$1
api=$2
Expand All @@ -40,11 +48,12 @@ download_and_create_avd() {
download_sdk $1
download_sysimage $2 $3
create_avd $2 $3
download_emulator $4
}

# Usage:
#
# setup_android_sdk 4333796 armeabi-v7a 18
# download_and_create_avd 4333796 armeabi-v7a 18 5264690
#
# 4333796 =>
# SDK tool version.
Expand All @@ -53,3 +62,6 @@ download_and_create_avd() {
# System image ABI
# 18 =>
# Android API Level (18 = Android 4.3 = Jelly Bean MR2)
# 5264690 =>
# Android Emulator version.
# Copy from the "build_id" in the `/android/sdk/emulator/emulator -version` output

0 comments on commit df7a91f

Please sign in to comment.