6

我使用一组 Linux 代理来构建我的应用程序。有时,代理会导致构建失败并出现以下错误:

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

因为我的构建代理是远程的(android 是预安装的 /opt/android-sdk-linux/tools/android),所以我无法预安装平台工具、构建工具等,所以我的项目中包含了一个 makefile。签出代码后,它会调用 makefile 中的一个方法:

#!/bin/bash
git submodule init
git submodule update
make updateSDK
# EOF

makefile中的方法是:

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)

在成功的情况下,来自 Bamboo 的日志显示:

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

但时不时地,它连接到错误的存储库,或者:

Fetching URL: https://dl.google.com/android/repository/repository-8.xml

或者

Fetching URL: https://dl.google.com/android/repository/repository-10.xml

除了 url 之外,它与上面的日志相同。它给出了这个错误:

Error: Ignoring unknown package filter 'build-tools-23.0.3'

在这些情况下,xml 文件不包含构建工具 23.0.3,即这个位:

<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>

我试过清除代理预构建的缓存,每次都尝试列出工具,使用 http 和 https,但无济于事。

基本上我的问题是,android update sdk 命令从哪里获取repository-XX.xml url?你能强制这个到最新版本吗?

4

0 回答 0