1# Copyright 2015 Google Inc. 2# 3# Use of this source code is governed by a BSD-style license that can be 4# found in the LICENSE file. 5 6UTIL_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 7 8if [ "$(which adb)" != "" ]; then 9 ADB="$(which adb)" 10elif [ -d "$ANDROID_SDK_ROOT" ]; then 11 ADB="${ANDROID_SDK_ROOT}/platform-tools/adb" 12else 13 echo $ANDROID_SDK_ROOT 14 echo "No ANDROID_SDK_ROOT set (check that android_setup.sh was properly sourced)" 15 exit 1 16fi 17 18if [ ! -x $ADB ]; then 19 echo "The adb binary is not executable" 20 exit 1 21fi 22 23if [ $(uname) == "Linux" ]; then 24 ADB_REQUIRED="1.0.32" 25elif [ $(uname) == "Darwin" ]; then 26 ADB_REQUIRED="1.0.31 or 1.0.32" 27fi 28 29# get the version string as an array, use just the version numbers 30ADB_VERSION="$($ADB version)" 31ADB_VERSION=($ADB_VERSION) 32ADB_VERSION=${ADB_VERSION[4]} 33 34if [[ "$ADB_REQUIRED" != *"$ADB_VERSION"* ]]; then 35 echo "WARNING: Your ADB version is out of date!" 36 echo " Expected ADB Version: ${ADB_REQUIRED}" 37 echo " Actual ADB Version: ${ADB_VERSION}" 38fi 39