android - 由于未就 Android 许可证达成一致,通过 TFS 运行的 Gradle 构建失败
问题描述
我正在尝试使用 Gradle 为 Team Foundation Services 的 Android 应用程序设置自动构建。几乎所有东西都设置正确,但每次构建都失败,因为应用程序所依赖的两个模块没有同意它们的许可证。这是我得到的错误输出:
Checking the license for package Android SDK Build-Tools 28.0.3 in
C:\Tools\AndroidSdk\licenses
License for package Android SDK Build-Tools 28.0.3 accepted.
Preparing "Install Android SDK Build-Tools 28.0.3 (revision: 28.0.3)".
Warning: Failed to read or create install properties file.
Checking the license for package Android SDK Platform 28 in
C:\Tools\AndroidSdk\licenses
License for package Android SDK Platform 28 accepted.
Preparing "Install Android SDK Platform 28 (revision: 6)".
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.3 Android SDK Build-Tools 28.0.3
platforms;android-28 Android SDK Platform 28
Install the missing components using the SDK manager in Android Studio.
我已经尝试了在 StackOverflow 或其他地方找到的几乎所有东西。我从 %ANDROID_HOME%/Licenses 文件夹中删除了所有许可证,再次安装并同意条款(使用 sdkmanager.bat --licenses 命令);我添加了一个 PowerShell 脚本,它将每个模块的每个许可证文件从 %ANDROID_HOME%/Licenses 文件夹复制到输出文件夹;我重新安装了整个 SDK;我已确保代理有权编辑和删除工作文件夹中的文件。我也尝试过直接从构建服务器(没有 TFS 代理)运行构建并且它成功构建,这也很奇怪。
我错过了另一件我能做的事情吗?
解决方案
我们通过在安装 SDK 的文件夹中的 sdkmanager.bat 文件上运行“--update”命令解决了这个问题。SDK 中的一些模块得到了更新,错误消失了。
可以在 TFS 上的构建定义中将“--update”命令作为脚本步骤,因此当其中一个模块将被更新时,错误最终不会出现。
推荐阅读
- php - Symfony Messenger 长时间运行的 Worker 和 AMQP 心跳
- python - 与熊猫数据框的多对多映射
- c++ - C++函数优化问题
- msbuild - 在多目标构建中使用 $(OutputPath)?
- bash - 从 shell 脚本运行 docker 和 maven 时出错
- php - PHP / imagecolorat:在 RGB 中转换颜色但缺少颜色
- vb.net - 应用程序内存不足加载缩略图
- python - Python中concurrent.futures的多线程问题
- javascript - 如何创建一个 jquery 脚本来计算选中的复选框的数量
- visual-studio-code - 使用 C/C++ 扩展的不一致的 clang 格式应用程序