Failed to install the following Android SDK packages as some licences have not been accepted.

运行环境:

Android Studio 2021.1
Apple M1 arm64
MacOS Menterey

报错信息:

Failed to install the following Android SDK packages as some licences have not been accepted.
  build-tools;30.0.3 Android SDK Build-Tools 30.0.3
To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html

Using Android SDK: /Users/lyx/Library/Android/sdk


遇到问题马上翻译:

未能安装以下Android SDK软件包,因为某些许可证尚未被接受。
构建工具;30.0.3安卓SDK构建工具30.0.3
要构建此项目,请接受SDK许可协议,并使用Android Studio SDK管理器安装缺少的组件。
或者,要将许可协议从一个工作站转移到另一个工作站,请参阅http://d.android.com/r/studio-ui/export-licenses.html

使用Android SDK:/Users/lyx/Library/Android/SDK

解决办法:

新安装的环境没有接受许可,我们只需要手动接受一下许可就好了。
首先找到错误信息中提示的路径,把sdkmanager拖到终端,然后加上 --licenses参数(注意参数前有一个空格)

类似这样:

回车之后会提示许多的条款,全部填y即可(为了正常build,我莫得选择...):

最后,提示“所有的许可都已经被接受”

在回到Android Studio,就可以正常编译了

03-05 23:28