Jenkins Android CI:错误地尝试使用较低的构建工具版本

时间:2019-01-26 12:57:59

标签: android jenkins gradle android-sdk-build-tools

我已经设置了Jenkins来自动化我们的拉取请求,但是当Gradle(4.10.2)开始配置项目时,它将尝试使用较低版本的构建工具。 我们的应用程序都设置为使用28.0.3:

buildToolsVersion = "28.0.3"

但是,在日志中,我们将看到:

Configure project :MyProject[0m
Checking the license for package Android SDK Platform-Tools in /opt/android-sdk/licenses
License for package Android SDK Platform-Tools accepted.
Preparing "Install Android SDK Platform-Tools (revision: 28.0.1)".
Install Android SDK Platform-Tools (revision: 28.0.1)" ready.
Installing Android SDK Platform-Tools in /opt/android-sdk/platform-tools
Install Android SDK Platform-Tools (revision: 28.0.1)" complete.
Install Android SDK Platform-Tools (revision: 28.0.1)" finished.

但是,这将正确构建项目。在同一Jenkins上运行的另一个项目将尝试安装28.0.2并失败:

Configure project :MyApp[0m
/home/jenkins/workspace/MyApp_PR/?/.android/repositories.cfg could not be loaded.
Checking the license for package Android SDK Build-Tools 28.0.2 in /opt/android-sdk/licenses
License for package Android SDK Build-Tools 28.0.2 accepted.
Preparing "Install Android SDK Build-Tools 28.0.2 (revision: 28.0.2)".
Warning: Failed to read or create install properties file.
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring project ':app'.
> Failed to install the following SDK components:
build-tools;28.0.2 Android SDK Build-Tools 28.0.2

尝试创建空白的.android / repositories.cfg文件无效。

用于运行PR的图像设置如下:

ENV BUILD_TOOLS_VERSION 28.0.3
RUN ${ANDROID_HOME}/tools/bin/sdkmanager "build-tools;${BUILD_TOOLS_VERSION}" "platforms;android-26" "platforms;android-27" "platforms;android-28" "extras;android;m2repository" "extras;google;google_play_services" "extras;google;m2repository"

为什么gradle尝试使用较低版本的构建工具版本?为什么每个项目都不同?

0 个答案:

没有答案