使用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-Tools Android SDK Build-Tools 29.0.2 Android SDK Platform 29 The 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