5

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.

EmeraldAegis
  • 99
  • 3
  • 10

2 Answers2

18

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.

Christopher Orr
  • 110,418
  • 27
  • 198
  • 193
  • What do the -u and -t options mean? – Gabriel Jiva Dec 19 '13 at 20:14
  • @GabrielJiva You can check with `android update sdk --help`: `-u` performs the update on the command line without any GUI; `-t` filters the packages to be installed. In this case, only the build-tools component will be installed, rather than all available components. – Christopher Orr Dec 20 '13 at 22:09
0

Other way to do it, is manually update for the missing version using Android SDK Manager attached to Jenkins (Look for Configuration: ANDROID_SDK, then under it access "tools/android.sh")

enter image description here

Abhijeet
  • 8,561
  • 5
  • 70
  • 76