Fixed android 5.0.1 and 5.1.1

This commit is contained in:
butomo1989 2017-04-26 15:16:26 +02:00
parent 3679a9bd48
commit e325706d17
3 changed files with 23 additions and 9 deletions

View file

@ -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

View file

@ -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
}

View file

@ -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')