Installing Android dependencies - android-update-sdk: command not found


Trying to run my maven project for testing UI in android application. To prepare execution I need to run appium and run emulator. I can do all this on my local env from bash script. As project is on github I would like to use travis. This is appium/selenium/testng/java project. I’m not sure if I have .travis.yml with “language: android” or should I start with “language: java”. Anyway all components I install success but when I want to execute android sdk manager I can see this:

        - ANDROID_API_LEVEL=28
        - ANDROID_ABI=armeabi-v7a

        - tools
        - platform-tools
        - tools
        - extra-android-m2repository
        - 'android-sdk-preview-license-52d11cd2'
        - 'android-sdk-license-.+'
        - 'google-gdk-license-.+'

and this output

Setting environment variables from .travis.yml



$ export ANDROID_ABI=armeabi-v7a

Installing Android dependencies

0.13s$ android-update-sdk --components=tools --accept-licenses='android-sdk-preview-license-52d11cd2|android-sdk-license-.+|google-gdk-license-.+'

android-update-sdk: command not found

The command "android-update-sdk --components=tools --accept-licenses='android-sdk-preview-license-52d11cd2|android-sdk-license-.+|google-gdk-license-.+'" failed and exited with 127 during .

I was trying user dist: trusty. Maybe I should install android sdk, not sure because I did not see if anyone installing sdk


Solution I have found was replace:

language: android to language: java and do android things manually :

- export ANDROID_HOME=~/android-sdk-linux
- wget -q "" -O
- unzip -q -d ${ANDROID_HOME}
- rm
- PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/tools/bin:${ANDROID_HOME}/platform-tools
- mkdir -p ~/.android
- touch ~/.android/repositories.cfg
- yes | sdkmanager --licenses
- yes | sdkmanager "emulator" "tools" "platform-tools" > /dev/null
- yes | sdkmanager "platforms;android-25" > /dev/null
- yes | sdkmanager "build-tools;25.0.2" > /dev/null
- yes | sdkmanager "system-images;android-25;google_apis;armeabi-v7a" > /dev/null

I’m seeing this today as well. This is new, I just updated a dependency and now all my builds are failing. Is the java manual approach the only fix?

Here’s my travis config:

if: branch = master

language: android

  - rm -f  $HOME/.gradle/caches/modules-2/modules-2.lock
  - rm -fr $HOME/.gradle/caches/*/plugin-resolution/
    - $HOME/.gradle/caches/
    - $HOME/.gradle/wrapper/
    # Android build cache (see
    - $HOME/.android/build-cache

    - tools
    - platform-tools
    - tools
    - extra-android-m2repository

    # The BuildTools version used by your project
    - build-tools-28.0.3

    # The SDK version used to compile your project
    - android-28

    - 'android-sdk-license-.+'

  - yes | sdkmanager "platforms;android-28"
  - yes | sdkmanager "emulator" "tools" "platform-tools"
  - yes | sdkmanager --licenses
  - yes | sdkmanager "build-tools;28.0.3"

@stowy WFM.

Please link to the build, can’t say more otherwise.

For starters, since the built-in logic installs all the components specified under android: components:

  • I see no purpose in the before_install: section
  • neither for calling android-update-sdk at any point

The Android recipes/cookbook is desperately old and seemingly not maintained at the moment.

My advice is to manually set-up the sdkmanager CLI and let the Android Gradle plugin automatically download all nessesary dependencies. This feature is supported starting from Android Gradle 3.3 ( So it’s even easier than what @karcio described (you don’t need to tell Travis CI the SDK Plattform or Build Tools Version).

You can even use the language: minimal since it ships Java 8 to get the fastest possible boot times:

language: minimal
os: linux
dist: xenial
group: edge

  # for updates check (current 26.1.1)

  # set JAVA_HOME path
  - export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
  # download and unzip Android SDK command line tools
  - wget -nv$ANDROID_SDK_TOOLS
  - unzip -q $ANDROID_SDK_TOOLS -d $HOME/sdk
  # set SDK tools path variable and ANDROID_HOME
  - export PATH=$PATH:$HOME/sdk/tools/bin
  - export ANDROID_HOME=$HOME/sdk
  # create empty cfg file to prevent sdkmanager warning message
  - mkdir -p $HOME/.android && touch $HOME/.android/repositories.cfg
  # accept licenses for all available packages that have not already been accepted
  - yes | sdkmanager --licenses >/dev/null
  # set executable flag for gradle wrapper
  - chmod +x gradlew
  # create dir for gradle settings
  - mkdir -p $HOME/.gradle
  # disable gradle daemon for current user
  - echo "org.gradle.daemon=false" >> $HOME/.gradle/
  # set gradle log format to plain
  - echo "org.gradle.console=plain" >> $HOME/.gradle/
1 Like

Thanks @native-api. Here’s a build. I added the license accepting bit to fix an earlier issue. I’m not calling ‘android-update-sdk’ myself.

My build config also stopped working in the last days. Travis support estimated, that my machine got migrated to xenial ( i had no dist set). after adding “dist: trusty” the enviromant hat a working android-update-sdk again.

Seems like all examples linked at docs are outdated, because none of them got dist set correct. At least its mentioned at

This example works today:

thanks to Dominic Jodoin from travis support team

@stowy the build you linked to is all cancelled with no logs and I don’t see any relevant failures in other recent builds.

Testing dist: xenial does show the subj error. So adding dist: trusty should fix it. In the tests, I never got xenial when I omitted dist: with language: android but I guess this happens randomly.

Thanks @native-api again! I have currently migrated to @G00fY2’s solution which works for me, but if I can make some changes to make the android solution work again then I’ll test that out. :slight_smile:

The language: android cookbook has not been updated for more than 2 years and still has preinstalled SDK Tools, Build-Tools and SDK Version 25: android-sdk version 0.2.2

I don’t see much sense in sticking with that when you have to update all dependencies anyway and are forced to use an old distribution.

Also the components like extra-google-google_play_services, extra-google-m2repository and extra-android-m2repository are outdated/unnecessary, since Google moved the dependencies to their own Google Maven servers (the google() repository in your build.gradle).

Hi All, my builds are failing as of a few days ago despite having had only changed something totally unrelated to any dependency updates.

This build fails (only a trivial change to a JSON object):

Build config:

But the previous commit passed:

The only thing that changed was this JSON object.

Edit: working now all of a sudden :slight_smile: