Android应用构建:13:使用sdkmanager自动接受license的方法
发布日期:2021-06-30 20:16:00 浏览次数:2 分类:技术文章

本文共 1822 字,大约阅读时间需要 6 分钟。

在这里插入图片描述

使用sdkmanager, 需要手工输入y已确认接受license才能继续之后的安装,这篇文章介绍自动接受license的方式和写法。

问题现象

在使用sdkmanager安装sdk时,会又如下需要输入y接受license的过程,而如果希望全程无手工干预,比如此部分写在Dockerfile之中,则无法进行下一步安装,因为需要首先接受license才能继续安装。

[root@liumiaocn bin]# ./sdkmanager platform-tools "platforms;android-29" "build-tools;29.0.2"License android-sdk-license:            ] 10% Computing updates...              ---------------------------------------Terms and Conditions...省略14.7 The License Agreement, and your relationship with Google under the License Agreement, shall be governed by the laws of the State of California without regard to its conflict of laws provisions. You and Google agree to submit to the exclusive jurisdiction of the courts located within the county of Santa Clara, California to resolve any legal matter arising from the License Agreement. Notwithstanding this, you agree that Google shall still be allowed to apply for injunctive remedies (or an equivalent type of urgent legal relief) in any jurisdiction.January 16, 2019---------------------------------------Accept? (y/N): y[=======================================] 100% Unzipping... platform-tools/systr[root@liumiaocn bin]#

不做处理的Dockerfile的构建结果失败信息可能如下所示

Accept? (y/N): Skipping following packages as the license is not accepted:Android SDK Platform-ToolsAndroid SDK Build-Tools 29.0.2Android SDK Platform 29The following packages can not be installed since their licenses or those of the packages they depend on were not accepted:  platforms;android-29  build-tools;29.0.2  platform-tools

对应方法

执行命令:yes | sdkmanager --licenses

执行时会显示如下信息,可自动接受license,不再需要手动输入y。

Accept? (y/N): All SDK package licenses accepted[=======================================] 100% Unzipping... platform-tools/systr

此种对应方式是在如下文章中获取并确认的方法:

  • https://discuss.circleci.com/t/android-platform-28-sdk-license-not-accepted/27768

转载地址:https://liumiaocn.blog.csdn.net/article/details/103638793 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:Android应用构建:14:构建Android SDK的自定义镜像
下一篇:Android应用构建:12:使用gradle wrapper进行APK文件构建

发表评论

最新留言

很好
[***.229.124.182]2024年04月12日 00时30分00秒