今天重装Android Studio的时候出现了各种没见过的问题,害我整整弄了一天,到最后蹦出来这么个bug
Failed to install the following Android SDK packages as some licences have not been accepted.
You have not accepted the license agreements of the following SDK components:
[Android SDK Build-Tools 24, Android SDK Platform 24].
Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager.
Alternatively, to learn how to transfer the license agreements from one workstation to another, go to http://d.android.com/r/studio-ui/export-licenses.html
大体就是这样吧,错误问题是从别的地方抄来的(没人会刻意保存出错的问题吧)。
当时弄了好久都没弄好,差点就放弃了。
回宿舍后,科学上网看了一堆英文,又回来看中文的解决办法,发现关键字就是licences,在看了一堆乱七八糟的解决方案,终于找到了一篇靠谱的License for package Android SDK Build-Tools 28.0.2 not accepted.(MAC),人家用的MAC,直接套过来用不行。于是就好好想了想,解决办法如下:
首先打开命令行,进入到报错的sdk路径,找到可以处理licences的文件,我就贴出我的了
cd C:\Users\17720\AppData\Local\Android\SDK
cd tools
cd bin
这时该路径下有一个windows批处理文件sdkmanager,用这个来解决问题,调用命令
sdkmanager --licenses
然后等一小会就巴拉巴拉一大堆licenses等待你同意,全部选yes就可以,反正也看不懂。之后,再到AS里build一下就好了。