I use a pool of Linux agents to build my app. Every now and then an agent causes a build failure with the error:
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':ComponentThatReqBuildToolsRev23.0.3:preBuild'.
> failed to find Build Tools revision 23.0.3
Because my build agents are remote (android is pre-installed /opt/android-sdk-linux/tools/android), I cannot preinstall the platform tools, build tools etc so have have a makefile included with my project. After checking out the code, it calls a method in the makefile:
#!/bin/bash
git submodule init
git submodule update
make updateSDK
# EOF
The method in the makefile is:
PACKAGES = "tools,platform-tools,build-tools-21.1.2,android-22,build-tools-23.0.3,android-21,extra-android-support,extra-android-m2repository,extra-google-m2repository,extra-google,google_play_services"
updateSDK:
(sleep 5 && while [ 1 ]; do sleep 1; echo y; done) \
| android --clear-cache update sdk --no-ui --all \
--filter $(PACKAGES)
In successful cases, the log from Bamboo shows:
Refresh Sources:
Fetching https://dl.google.com/android/repository/addons_list-2.xml
Validate XML
Parse XML
Fetched Add-ons List successfully
Refresh Sources
Fetching URL: https://dl.google.com/android/repository/repository-11.xml
Validate XML: https://dl.google.com/android/repository/repository-11.xml
Parse XML: https://dl.google.com/android/repository/repository-11.xml
Fetching URL: https://dl.google.com/android/repository/addon.xml
Validate XML: https://dl.google.com/android/repository/addon.xml
Parse XML: https://dl.google.com/android/repository/addon.xml
Fetching URL: https://dl.google.com/android/repository/glass/addon.xml
Validate XML: https://dl.google.com/android/repository/glass/addon.xml
Parse XML: https://dl.google.com/android/repository/glass/addon.xml
Fetching URL: https://dl.google.com/android/repository/extras/intel/addon.xml
Validate XML: https://dl.google.com/android/repository/extras/intel/addon.xml
Parse XML: https://dl.google.com/android/repository/extras/intel/addon.xml
Fetching URL: https://dl.google.com/android/repository/sys-img/android/sys-img.xml
Validate XML: https://dl.google.com/android/repository/sys-img/android/sys-img.xml
Parse XML: https://dl.google.com/android/repository/sys-img/android/sys-img.xml
Fetching URL: https://dl.google.com/android/repository/sys-img/android-wear/sys-img.xml
Validate XML: https://dl.google.com/android/repository/sys-img/android-wear/sys-img.xml
Parse XML: https://dl.google.com/android/repository/sys-img/android-wear/sys-img.xml
\Fetching URL: https://dl.google.com/android/repository/sys-img/android-tv/sys-img.xml
Validate XML: https://dl.google.com/android/repository/sys-img/android-tv/sys-img.xml
Parse XML: https://dl.google.com/android/repository/sys-img/android-tv/sys-img.xml
Fetching URL: https://dl.google.com/android/repository/sys-img/google_apis/sys-img.xml
Validate XML: https://dl.google.com/android/repository/sys-img/google_apis/sys-img.xml
Parse XML: https://dl.google.com/android/repository/sys-img/google_apis/sys-img.xml
Fetching URL: https://dl.google.com/android/repository/sys-img/x86/addon-x86.xml
Validate XML: https://dl.google.com/android/repository/sys-img/x86/addon-x86.xml
Parse XML: https://dl.google.com/android/repository/sys-img/x86/addon-x86.xml
License id: android-sdk-license-c81a61d9
Used by:
- Android SDK Tools, revision 25.1.3
- Android SDK Platform-tools, revision 23.1
- Android SDK Build-tools, revision 23.0.3
- Android SDK Build-tools, revision 21.1.2
- SDK Platform Android 5.1.1, API 22, revision 2
- SDK Platform Android 5.0.1, API 21, revision 2
- Android Support Repository, revision 30
- Android Support Library, revision 23.2.1 (Obsolete)
- Google Play services, revision 29
- Google Repository, revision 25
...
Do you accept the license 'android-sdk-license-c81a61d9' [y/n]:
y'. (There's a few of these)
Lots of lines of install code....
Finished task 'Update Android SDK' with result: Success
But every now and then, it connects to the wrong repository, either:
Fetching URL: https://dl.google.com/android/repository/repository-8.xml
or
Fetching URL: https://dl.google.com/android/repository/repository-10.xml
It's identical to the above log except for the url. It gives this error:
Error: Ignoring unknown package filter 'build-tools-23.0.3'
In these cases, the xml file does not contain build tools 23.0.3, i.e. this bit:
<sdk:archive>
<!--Built on: Tue Mar 15 17:38:51 2016.-->
<sdk:size>40733174</sdk:size>
<sdk:checksum type="sha1">368f2600feac7e9b511b82f53d1f2240ae4a91a3</sdk:checksum>
<sdk:url>build-tools_r23.0.3-linux.zip</sdk:url>
<sdk:host-os>linux</sdk:host-os>
</sdk:archive><sdk:archive>
<!--Built on: Tue Mar 15 17:38:50 2016.-->
<sdk:size>39679533</sdk:size>
<sdk:checksum type="sha1">fbc98cd303fd15a31d472de6c03bd707829f00b0</sdk:checksum>
<sdk:url>build-tools_r23.0.3-macosx.zip</sdk:url>
<sdk:host-os>macosx</sdk:host-os></sdk:archive>
<sdk:archive>
<!--Built on: Tue Mar 15 17:38:48 2016.-->
<sdk:size>39869945</sdk:size>
<sdk:checksum type="sha1">c6d8266c6a3243c8f1e41b786c0e3cee4c781263</sdk:checksum>
<sdk:url>build-tools_r23.0.3-windows.zip</sdk:url>
<sdk:host-os>windows</sdk:host-os>
</sdk:archive>
I've tried clearing the cache on the agent pre-build, I've tried listing the tools each time, used http and https and to no avail.
Basically my question is, where does the android update sdk command get the repository-XX.xml url from? Can you force this to the latest version?