Android-Jenkins: failed to find Build Tools revision 17.0.0 On Jenkins Build Server

androidci-servercontinuous integrationJenkins

I'm trying to use the Android Emulator on Jenkins to build and test my project. But I'm getting an the following error when running my gradle tasks;

failed to find Build Tools revision 17.0.0

the gradle task I'm running is;

./gradlew clean connectedCheck

in my gradle build file I has the following configuration

android {
  compileSdkVersion 17
  buildToolsVersion "17.0.0"

  defaultConfig {
    minSdkVersion 7
    targetSdkVersion 17
  }
}

The build server is a headless Ubuntu instance (12 something). My first thought was that I didn't have the correct build tools installed so I had a look in my android-sdk/build-tools director. All I could see was a directory called 18.1.1. So I thought if I updated my android sdk it would download version 17.0.0. So I ran the following command:

android update sdk --no-ui

and it seems to download various many things but looking in the build tools directory again I still only see version 18.1.1.

So questions are:

1) Am I right in assuming the build is failing because I don't have the correct build tools revision in my android sdk directory? (/android-sdk/build-tools)

2) How do I update the build-tools on a headless server so that I have version 17.0.0?

If you need me to provide more information, please let me know.

Thanks in advance for you help.

Best Answer

By default, android update sdk (or android list sdk --extended) only lists the packages which aren't considered deprecated.

As Build Tools 17.0.0 is a comparatively old version, it won't be shown by default.

Running with the -a (--all) flag will get you the older versions, e.g.:
android update sdk -u -a -t build-tools-17.0.0


At some point in the future the Jenkins plugin should automatically install the correct build tools for you, based on your build.gradle file.


Edit (Nov 2015): This functionality probably will not be added to the Android Emulator plugin.

Nowadays I would recommend using the android-sdk-manager Gradle plugin, which automates the installation of all prerequisites for a Jenkins build, including Android SDK, tools, build-tools, platforms, support libraries etc.

This can be very easily integrated into your project, and removes the need to keep the Android SDK installation on your Jenkins build machines up-to-date.