Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
Parameterize emulator arch
Browse files Browse the repository at this point in the history
  • Loading branch information
plastiv committed Feb 28, 2019
1 parent 105e892 commit 817ba0d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
20 changes: 10 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ services:
- docker

env:
- EMULATOR_SDK_VERSION=21
- EMULATOR_SDK_VERSION=22
- EMULATOR_SDK_VERSION=23
- EMULATOR_SDK_VERSION=24
- EMULATOR_SDK_VERSION=25
- EMULATOR_SDK_VERSION=26
- EMULATOR_SDK_VERSION=27
- EMULATOR_SDK_VERSION=28
- EMULATOR_API_LEVEL=21 EMULATOR_ARCH=x86_64
- EMULATOR_API_LEVEL=22 EMULATOR_ARCH=x86_64
- EMULATOR_API_LEVEL=23 EMULATOR_ARCH=x86_64
- EMULATOR_API_LEVEL=24 EMULATOR_ARCH=x86_64
- EMULATOR_API_LEVEL=25 EMULATOR_ARCH=x86_64
- EMULATOR_API_LEVEL=26 EMULATOR_ARCH=x86_64
- EMULATOR_API_LEVEL=27 EMULATOR_ARCH=x86
- EMULATOR_API_LEVEL=28 EMULATOR_ARCH=x86_64

before_install:
- docker build --build-arg EMULATOR_SDK_VERSION -t android-emulator-$EMULATOR_SDK_VERSION android-emulator/
- docker build --build-arg EMULATOR_API_LEVEL --build-arg EMULATOR_ARCH -t android-emulator-$EMULATOR_API_LEVEL android-emulator/

script:
- docker run -it --rm --env EMULATOR_SDK_VERSION --volume=$(pwd)/android-emulator:/opt/workspace --entrypoint /opt/workspace/start-emulator.sh android-emulator-$EMULATOR_SDK_VERSION
- docker run -it --rm --env EMULATOR_API_LEVEL --volume=$(pwd)/android-emulator:/opt/workspace --entrypoint /opt/workspace/start-emulator.sh android-emulator-$EMULATOR_API_LEVEL
7 changes: 4 additions & 3 deletions android-emulator/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM debian:stretch

ARG EMULATOR_SDK_VERSION
ARG EMULATOR_API_LEVEL
ARG EMULATOR_ARCH

# Install java and dependencies
# to debug missing lib issues use ldconfig -p | grep libGL
Expand Down Expand Up @@ -81,11 +82,11 @@ RUN echo "y" | sdkmanager "build-tools;28.0.3" \
"emulator" \
"platform-tools" \
"platforms;android-28" \
"system-images;android-${EMULATOR_SDK_VERSION};google_apis;x86_64" \
"system-images;android-${EMULATOR_API_LEVEL};google_apis;${EMULATOR_ARCH}" \
"tools" >/dev/null

# Create AVD
RUN echo "no" | avdmanager --silent create avd --force --name android-emulator-$EMULATOR_SDK_VERSION --device "4in WVGA (Nexus S)" --package "system-images;android-${EMULATOR_SDK_VERSION};google_apis;x86_64"
RUN echo "no" | avdmanager --silent create avd --force --name android-emulator-$EMULATOR_API_LEVEL --device "4in WVGA (Nexus S)" --package "system-images;android-${EMULATOR_API_LEVEL};google_apis;${EMULATOR_ARCH}"

# GO to workspace
RUN mkdir -p /opt/workspace
Expand Down
2 changes: 1 addition & 1 deletion android-emulator/start-emulator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ sdkmanager --list
emulator -list-avds
emulator-check accel hyper-v cpu-info
# https://developer.android.com/studio/run/emulator-commandline#startup-options
emulator -verbose -avd android-emulator-${EMULATOR_SDK_VERSION} \
emulator -verbose -avd android-emulator-${EMULATOR_API_LEVEL} \
-no-accel \
-no-audio \
-no-window \
Expand Down

0 comments on commit 817ba0d

Please sign in to comment.