您尚未接受以下 SDK 组件的许可协议 [英] You have not accepted the license agreements of the following SDK components
问题描述
我下载了最新的 Android SDK 工具版本 24.4.1.我使用命令行来安装 SDK.我在询问时输入了 y
I downloaded the latest Android SDK tools version 24.4.1. I used the command line to install SDKs. I typed y
when asked
您是否接受许可 'android-sdk-license-c81a61d9' [y/n]: y安装成功后.
Do you accept the license 'android-sdk-license-c81a61d9' [y/n]: y after that install succeeded.
但是使用Gradle 3.1构建时,出现如下
But when using Gradle 3.1 to build, the follows shows up
您尚未接受以下 SDK 组件的许可协议:[Android SDK 平台 23,Android SDK 构建工具 23.0.1].在构建项目之前,您需要接受许可协议并使用 Android Studio SDK 管理器完成缺失组件的安装.或者,要了解如何将许可协议从一个工作站转移到另一个工作站,请转到 http://d.android.com/r/studio-ui/export-licenses.html
You have not accepted the license agreements of the following SDK components: [Android SDK Platform 23, Android SDK Build-Tools 23.0.1]. 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
我检查了 ~/.android
和 /opt/android-sdk
放置 Android 工具的位置.都不包含名为 licenses
的文件夹.
I checked ~/.android
and /opt/android-sdk
where Android tools are put. Neither contain folder named licenses
.
推荐答案
从命令行接受许可协议的方式已经改变.您可以使用位于以下位置的 SDK 管理器:$ANDROID_SDK_ROOT/tools/bin
The way to accept license agreements from the command line has changed. You can use the SDK manager which is located at: $ANDROID_SDK_ROOT/tools/bin
例如在Linux上:
cd ~/Library/Android/sdk/tools/bin/
运行sdkmanager如下:
Run the sdkmanager as follows:
./sdkmanager --licenses
例如在 Windows 上:
e.g on Windows:
cd /d "%ANDROID_SDK_ROOT%/tools/bin"
运行sdkmanager如下:
Run the sdkmanager as follows:
sdkmanager --licenses
并接受您尚未接受(但需要)的许可.
And accept the licenses you did not accept yet (but need to).
有关更多详细信息,请参阅 Android Studio 文档,尽管当前文档缺少关于 --licenses
选项的任何描述.
For more details see the Android Studio documentation, although the current documentation is missing any description on the --licenses
option.
您的机器上可能有两个 Android SDK.确保同时检查 ~/Library/Android/sdk
和 /usr/local/share/android-sdk
!如果不确定,请从您的机器上完全卸载 Android Studio 并启动干净利落.
You might have two Android SDKs on your machine. Make sure to check both ~/Library/Android/sdk
and /usr/local/share/android-sdk
! If unsure, fully uninstall Android Studio from your machine and start with a clean slate.
更新:ANDROID_HOME 已弃用,ANDROID_SDK_ROOT 现在是正确的变量
Update: ANDROID_HOME is deprecated, ANDROID_SDK_ROOT is now the correct variable
这篇关于您尚未接受以下 SDK 组件的许可协议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!