对于android中sdk已经存在的报错问题

Failed to install the following Android SDK packages as some licences have not been accepted.
   build-tools;30 Android SDK Build-Tools 30
   platforms;android-28 Android SDK Platform 30
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:\androidstudio\sdk

报错原因如上

主要原因是电脑上之前已经安装过SDK,没有接受 许可协议导致的。

首先打开命令行,进入到报错的sdk路径,找到可以处理licences的文件

d:
D:\cd androidstudio
D:\
androidstudio>cd sdk
D:\androidstudio\sdk>cd tools 

D:\
androidstudio\sdk\tools>cd bin

D:\
androidstudio\sdk\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

最后重启andio studio

 

参考:https://www.cnblogs.com/wangjie1990/p/11327584.html
posted @ 2021-11-29 11:33  夜柠檬  阅读(458)  评论(0编辑  收藏  举报