#!/usr/bin/env bash
#
# Install required dependencies
# $ANDROID_HOME must be set to be cached on CI setup
#

DEPS_FILE="$ANDROID_HOME/android-dependencies-installed"

if [ ! -e $DEPS_FILE ]; then

  for I in android-25 \
           build-tools-25.0.2  \
           tool \
           extra-android-m2repository \
           extra-android-support \
           extra-google-google_play_services \
           extra-google-m2repository;
   do echo y | android update sdk --no-ui --all --filter $I ; done

   touch DEPS_FILE;

 fi

#!/usr/bin/env bash
#
# Install required dependencies
# sdkmanager can be found in $ANDROID_HOME/tools/bin/sdkmanager
#

# Accept licences
# src http://vgaidarji.me/blog/2017/05/31/automatically-accept-android-sdkmanager-licenses/
/usr/bin/expect -c '
set timeout -1;
spawn '"${ANDROID_HOME}"'/tools/bin/sdkmanager --licenses;
  expect {
    "y/N" { exp_send "y\r" ; exp_continue }
    eof
  }
'

for I in "platforms;android-25" \
         "platforms;android-23" \
         "platforms;android-21" \
         "buildDate-tools;25.0.6" \
         "extras;google;m2repository" \
         "extras;android;m2repository" \
         "extras;google;google_play_services"; do
    echo "Trying to update with tools/bin/sdkmanager: " $I
    sdkmanager $I
done

sdkmanager --update

Update install script to use sdkmanager
Update install script to use sdkmanager

android command is deprecated