1#!/bin/sh 2set -ex 3 4export ANDROID_HOME=/android/sdk 5PATH=$PATH:"${ANDROID_HOME}/tools/bin" 6LOCKFILE="${ANDROID_HOME}/android-sdk.lock" 7 8# To add a new packages to the SDK or to update an existing one you need to 9# run the command: 10# 11# android-sdk-manager.py add-to-lockfile $LOCKFILE <package-name> 12# 13# Then, after every lockfile update the mirror has to be synchronized as well: 14# 15# android-sdk-manager.py update-mirror $LOCKFILE 16# 17/scripts/android-sdk-manager.py install "${LOCKFILE}" "${ANDROID_HOME}" 18 19details=$(cat "${LOCKFILE}" \ 20 | grep system-images \ 21 | sed 's/^system-images;android-\([0-9]\+\);default;\([a-z0-9-]\+\) /\1 \2 /g') 22api="$(echo "${details}" | awk '{print($1)}')" 23abi="$(echo "${details}" | awk '{print($2)}')" 24 25# See https://developer.android.com/studio/command-line/avdmanager.html for 26# usage of `avdmanager`. 27echo no | avdmanager create avd \ 28 -n "$abi-$api" \ 29 -k "system-images;android-$api;default;$abi" 30