@@ -11,6 +11,8 @@ ENV DEBIAN_FRONTEND noninteractive
1111ENV VERSION_SDK_TOOLS "25.1.7"
1212ENV VERSION_BUILD_TOOLS "24.0.2"
1313ENV VERSION_TARGET_SDK "24"
14+ ENV VERSION_EMULATOR_GOOGLE_APIS_TARGET_SDK "23"
15+ # There's no 24 emulator with Google APIs yet.
1416
1517ENV ANDROID_HOME "/sdk"
1618ENV PATH "$PATH:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools"
@@ -32,7 +34,7 @@ RUN apt-get -qq update && \
3234 build-essential \
3335 expect \
3436 file \
35- libmagic1
37+ libmagic1 \
3638 && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
3739
3840# Fix certificates
@@ -54,29 +56,44 @@ RUN chmod +x /usr/local/bin/tools/wait-for-emulator.sh
5456
5557# And use them to install Android dependencies
5658
57- RUN ["/opt/tools/android-accept-licenses.sh" , "android update sdk --all --no-ui --filter \
58- platform-tools, \
59- android-${VERSION_TARGET_SDK}, \
60- build-tools-${VERSION_BUILD_TOOLS}, \
61- sys-img-armeabi-v7a-google_apis-${VERSION_TARGET_SDK}, \
62- extra-android-m2repository, \
63- extra-google-m2repository, \
64- extra-android-support, \
65- extra-google-google_play_services" ]
59+ RUN /usr/local/bin/tools/agree-to-licenses.sh \
60+ "android update sdk --all --no-ui --filter platform-tools,android-${VERSION_TARGET_SDK},android-${VERSION_EMULATOR_GOOGLE_APIS_TARGET_SDK},build-tools-${VERSION_BUILD_TOOLS},sys-img-armeabi-v7a-android-${VERSION_TARGET_SDK},sys-img-armeabi-v7a-google_apis-${VERSION_EMULATOR_GOOGLE_APIS_TARGET_SDK},extra-android-support,extra-android-m2repository,extra-google-m2repository,extra-google-google_play_services"
6661
67- # Create emulator
62+ # Create emulators
6863
64+ RUN android list targets
65+
66+ # Without Google APIs
6967RUN echo "no" | android create avd \
7068 --force \
7169 --device "Nexus 5" \
7270 --name nexus5_${VERSION_TARGET_SDK} \
7371 --target android-${VERSION_TARGET_SDK} \
72+ --abi default/armeabi-v7a \
73+ --skin WVGA800 \
74+ --sdcard 512M
75+
76+ # With Google APIs
77+ RUN echo "no" | android create avd \
78+ --force \
79+ --device "Nexus 5" \
80+ --name nexus5_${VERSION_EMULATOR_GOOGLE_APIS_TARGET_SDK} \
81+ --target android-${VERSION_EMULATOR_GOOGLE_APIS_TARGET_SDK} \
7482 --abi google_apis/armeabi-v7a \
7583 --skin WVGA800 \
7684 --sdcard 512M
7785
78- # Boot up the emulator
86+ # Boot up the emulators
87+
88+ # Without Google APIs
89+ RUN /bin/bash -c "SHELL=/bin/bash emulator -avd nexus5_${VERSION_TARGET_SDK} -no-skin -no-audio -no-window & \
90+ adb wait-for-device && \
91+ /usr/local/bin/tools/wait-for-emulator.sh" && \
92+ adb -s emulator-5554 emu kill
93+
7994
80- RUN ["/bin/bash" , "-c" , "SHELL=/bin/bash emulator -avd nexus5_${VERSION_TARGET_SDK} -no-skin -no-audio -no-window & /usr/local/bin/tools/wait-for-emulator.sh" ]
81- RUN adb wait-for-device
82- RUN android-start-emulator nexus5_${VERSION_TARGET_SDK} && adb -s emulator-5554 emu kill
95+ # With Google APIs
96+ RUN /bin/bash -c "SHELL=/bin/bash emulator -avd nexus5_${VERSION_EMULATOR_GOOGLE_APIS_TARGET_SDK} -no-skin -no-audio -no-window & \
97+ adb wait-for-device && \
98+ /usr/local/bin/tools/wait-for-emulator.sh" && \
99+ adb -s emulator-5554 emu kill
0 commit comments