From e325706d17246e322a951ccb5b0e5a57b4d7e384 Mon Sep 17 00:00:00 2001 From: butomo1989 Date: Wed, 26 Apr 2017 15:16:26 +0200 Subject: [PATCH] Fixed android 5.0.1 and 5.1.1 --- Dockerfile | 6 ++++-- release.sh | 15 ++++++++++++--- src/app.py | 11 +++++++---- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index c1adb5c..91c6d52 100644 --- a/Dockerfile +++ b/Dockerfile @@ -119,17 +119,19 @@ ARG BUILD_TOOL=21.1.2 ARG API_LEVEL=21 ARG PROCESSOR=x86 ARG SYS_IMG=x86_64 +ARG IMG_TYPE=google_apis ENV ANDROID_VERSION=$ANDROID_VERSION \ BUILD_TOOL=$BUILD_TOOL \ API_LEVEL=$API_LEVEL \ PROCESSOR=$PROCESSOR \ - SYS_IMG=$SYS_IMG + SYS_IMG=$SYS_IMG \ + IMG_TYPE=$IMG_TYPE RUN echo y | android update sdk --no-ui -a --filter build-tools-${BUILD_TOOL} ENV PATH ${PATH}:${ANDROID_HOME}/build-tools RUN rm ${ANDROID_HOME}/tools/emulator \ && ln -s ${ANDROID_HOME}/tools/emulator64-${PROCESSOR} ${ANDROID_HOME}/tools/emulator -RUN echo y | android update sdk --no-ui -a -t android-${API_LEVEL},sys-img-${SYS_IMG}-google_apis-${API_LEVEL} +RUN echo y | android update sdk --no-ui -a -t android-${API_LEVEL},sys-img-${SYS_IMG}-${IMG_TYPE}-${API_LEVEL} #================================================ # noVNC Default Configurations diff --git a/release.sh b/release.sh index c094713..c352682 100755 --- a/release.sh +++ b/release.sh @@ -94,7 +94,7 @@ get_processors function test() { (export ANDROID_HOME=/root && export ANDROID_VERSION=5.0.1 && export API_LEVEL=21 \ - && export PROCESSOR=x86 && export SYS_IMG=x86_64 && nosetests -v) + && export PROCESSOR=x86 && export SYS_IMG=x86_64 && export IMG_TYPE=google_apis && nosetests -v) } function build() { @@ -104,6 +104,13 @@ function build() { # Build docker image(s) for p in "${processors[@]}"; do for v in "${versions[@]}"; do + # Find image type + if [ "$v" == "5.0.1" ] || [ "$v" == "5.1.1" ]; then + IMG_TYPE=android + else + IMG_TYPE=google_apis + fi + echo "[BUILD] IMAGE TYPE: $IMG_TYPE" level=${list_of_levels[$v]} echo "[BUILD] API Level: $level" sys_img=${list_of_processors[$p]} @@ -112,9 +119,11 @@ function build() { image_latest="$IMAGE-$p-$v:latest" echo "[BUILD] Image name: $image_version and $image_latest" docker build -t $image_version --build-arg ANDROID_VERSION=$v --build-arg BUILD_TOOL=$LATEST_BUILD_TOOL \ - --build-arg API_LEVEL=$level --build-arg PROCESSOR=$p --build-arg SYS_IMG=$sys_img . + --build-arg API_LEVEL=$level --build-arg PROCESSOR=$p --build-arg SYS_IMG=$sys_img \ + --build-arg IMG_TYPE=$IMG_TYPE . docker build -t $image_latest --build-arg ANDROID_VERSION=$v --build-arg BUILD_TOOL=$LATEST_BUILD_TOOL \ - --build-arg API_LEVEL=$level --build-arg PROCESSOR=$p --build-arg SYS_IMG=$sys_img . + --build-arg API_LEVEL=$level --build-arg PROCESSOR=$p --build-arg SYS_IMG=$sys_img \ + --build-arg IMG_TYPE=$IMG_TYPE . done done } diff --git a/src/app.py b/src/app.py index 75c3bf8..59fcb0d 100644 --- a/src/app.py +++ b/src/app.py @@ -44,12 +44,14 @@ ANDROID_VERSION = get_or_raise('ANDROID_VERSION') API_LEVEL = get_or_raise('API_LEVEL') PROCESSOR = get_or_raise('PROCESSOR') SYS_IMG = get_or_raise('SYS_IMG') +IMG_TYPE = get_or_raise('IMG_TYPE') logger.info('Android version: {version} \n' 'API level: {level} \n' 'Processor: {processor} \n' - 'System image: {img}'.format(version=ANDROID_VERSION, level=API_LEVEL, processor=PROCESSOR, - img=SYS_IMG)) + 'System image: {img} \n' + 'Image type: {img_type}'.format(version=ANDROID_VERSION, level=API_LEVEL, processor=PROCESSOR, + img=SYS_IMG, img_type=IMG_TYPE)) def prepare_avd(device: str, avd_name: str): @@ -59,8 +61,9 @@ def prepare_avd(device: str, avd_name: str): :param device: Device name :param avd_name: Name of android virtual device / emulator """ - cmd = 'echo no | android create avd -f -n {name} -t android-{api} -b google_apis/{sys_img}'.format( - name=avd_name, api=API_LEVEL, sys_img=SYS_IMG) + cmd = 'echo no | android create avd -f -n {name} -t android-{api} -b {img_type}{sys_img}'.format( + name=avd_name, api=API_LEVEL, img_type='google_apis/' if IMG_TYPE == 'google_apis' else '', + sys_img=SYS_IMG) # Link emulator skins skin_rsc_path = os.path.join(ROOT, 'devices', 'skins')