由于未接受某些许可证,无法安装以下 Android 个 SDK 包。平台 29

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

我有这个错误,但接受 sdk 许可协议

* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Failed to install the following Android SDK packages as some licences have not been accepted.
     build-tools;29.0.2 Android SDK Build-Tools 29.0.2
     platforms;android-29 Android SDK Platform 29
  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: /usr/lib/android-sdk

我有两个android-sdk

一个在 /usr/lib/android-sdk 另一个在 home/bug/Android/Sdk

 yes | $ANDROID_SDK_ROOT/tools/bin/sdkmanager "build-tools;29.0.2"
Warning: File /home/bug/.android/repositories.cfg could not be loaded.          
[=======================================] 100% Computing updates...

我在 home/bug/Android-----

中接受了这个命令

但如何在 /usr/lib/android-sdk 中接受许可????

您可以使用

yes |  /usr/lib/android-sdk/tools/bin/sdkmanager --licenses

我不确定,但您可能还需要创建 repositories.cfg 文件:

mkdir ~/.android
echo "count=0" > ~/.android/repositories.cfg

我解决了将许可证复制到 /usr/lib/android-sdk

中的问题
sudo cp -R licenses /usr/lib/android-sdk