安卓12:重新安装Android studio后,打开旧项目出现 Failed to install the following Android SDK

重新安装 Android Studio后出现了下面的错误,系统不能正常build工程。
Failed to install the following Android SDK packages as some licences have not been accepted.
build-tools;28.0.3 Android SDK Build-Tools 28.0.3
platforms;android-28 Android SDK Platform 28
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: D:\software\sdk

造成问题的原因是电脑上之前已经安装过SDK,没有接受许可协议。
解决办法:
win键+R–输入cmd–进入到命令行界面,通过以下代码找到可以处理licences的文件(我保存SDK文件的地址是AndroidSDK)

D:\AndroidSDK>cd tools
D:\AndroidSDK\tools>cd bin
D:\AndroidSDK\tools\bin>sdkmanager --licenses
Warning: File C:\Users\Administrator\.android\repositories.cfg could not be loaded.
6 of 6 SDK package licenses not accepted.
Review licenses that have not been accepted (y/N)? y
..... 出现是否接受,均输入y

全部接受完协议之后就可以正常运行Android Studio了。

猜你喜欢

转载自blog.csdn.net/qq_43374694/article/details/112851497