您尚未接受以下SDK组件的许可协议[重复]

在使用Gradle 3.1构建时遇到未接受的SDK组件许可协议问题,如Android SDK Platform 23和Build-Tools 23.0.1。可以通过命令行或Android SDK Manager GUI接受许可协议。解决方案包括:通过命令行更新SDK并接受许可,或打开SDK Manager安装所需版本的SDK Build Tools。确保检查$ANDROID_HOME(现在推荐使用$ANDROID_SDK_ROOT)路径下的licenses文件夹,确保存在接受的许可证文件。
摘要由CSDN通过智能技术生成

本文翻译自:You have not accepted the license agreements of the following SDK components [duplicate]

This question already has an answer here: 这个问题已经在这里有了答案:

I downloaded the latest Android SDK tools version 24.4.1. 我下载了最新的Android SDK工具版本24.4.1。 I used the command line to install SDKs. 我使用命令行来安装SDK。 I typed y when asked 当系统询问时我输入了y

Do you accept the license 'android-sdk-license-c81a61d9' [y/n]: y after that install succeeded. 成功安装后,您是否接受许可证'android-sdk-license-c81a61d9'[y / n]:y。

But when using Gradle 3.1 to build, the follows shows up 但是当使用Gradle 3.1进行构建时,将显示以下内容

You have not accepted the license agreements of the following SDK components: [Android SDK Platform 23, Android SDK Build-Tools 23.0.1]. 您尚未接受以下SDK组件的许可协议:[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. 在构建项目之前,您需要接受许可协议并使用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 另外,要了解如何将许可协议从一个工作站转移到另一个工作站,请访问http://d.android.com/r/studio-ui/export-licenses.html

I checked ~/.android and /opt/android-sdk where Android tools are put. 我检查了放置Android工具的~/.android/opt/android-sdk Neither contain folder named licenses . 都不包含名为licenses文件夹。


#1楼

参考:https://stackoom.com/question/2gpR6/您尚未接受以下SDK组件的许可协议-重复


#2楼

I solved the problem by opening the Android SDK Manager and installing the SDK build tools for the version it is complaining about (API 24). 我通过打开Android SDK Manager并为其抱怨的版本(API 24)安装SDK生成工具来解决了该问题。

I had also updated using the command line previously and I suspect the Android SDK Manager has a more complete way of resolving dependencies, including the license. 我以前也使用命令行进行过更新,我怀疑Android SDK Manager具有解决依赖关系(包括许可证)的更完整方法。


#3楼

You can install and accept the license of the SDK & tools via 2 ways: 您可以通过两种方式安装和接受SDK和工具的许可证:

1. Open the Android SDK Manager GUI via command line 1.通过命令行打开Android SDK Manager GUI

Open the Android SDK manager via the command line using: 使用以下命令通过命令行打开Android SDK管理器:

# Android SDK Tools 25.2.3 and lower - Open the Android SDK GUI via the command line
cd ~/Library/Android/sdk/tools && ./android

# 'Android SDK Tools' 25.2.3 and higher - `sdkmanager` is located in android_sdk/tools/bin/.
cd ~/Library/Android/sdk/tools/bin && ./sdkmanager

View more details on the new sdkmanager . 查看有关新sdkmanager更多详细信息

Select and install the required tools. 选择并安装所需的工具。 (your location may be different) (您的位置可能有所不同)

2. Install and accept android license via command line: 2.通过命令行安装并接受android许可证:

Update the packages via command line, you'll be presented with the terms and conditions which you'll need to accept. 通过命令行更新软件包,将向您显示您需要接受的条款和条件。

- Install or update to the latest version -安装或更新到最新版本

This will install the latest platform-tools at the time you run it. 这将在您运行时安装最新的platform-tools

# Android SDK Tools 25.2.3 and lower. Install the latest `platform-tools` for android-25
android update sdk --no-ui --all --filter platform-tools,android-25,extra-android-m2repository

# Android SDK Tools 25.2.3 and higher
sdkmanager --update

- Install a specific version ( 25.0.1 , 24.0.1 , 23.0.1 ) -安装特定的版本( 25.0.124.0.123.0.1

You can also install a specific version like so: 您还可以安装特定的版本,如下所示:

# Build Tools 23.0.1, 24.0.1, 25.0.1
android update sdk --no-ui --all --filter build-tools-25.0.1,android-25,extra-android-m2repository
android update sdk --no-ui --all --filter build-tools-24.0.1,android-24,extra-android-m2repository
android update sdk --no-ui --all --filter build-tools-23.0.1,android-23,extra-android-m2repository
# Alter the versions as required                      ↑               ↑

# -u --no-ui  : Updates from command-line (does not display the GUI)
# -a --all    : Includes all packages (such as obsolete and non-dependent ones.)
# -t --filter : A filter that limits the update to the specified types of
#               packages in the form of a comma-separated list of
#               [platform, system-image, tool, platform-tool, doc, sample,
#               source]. This also accepts the identifiers returned by
#               'list sdk --extended'.

# List version and description of other available SDKs and tools
android list sdk --extended
sdkmanager --list

#4楼

I have resolved the issue by below steps: 我已通过以下步骤解决了该问题:

  1. update the android sdk with command "tools/android update sdk --no-ui" 使用命令“ tools / android update sdk --no-ui”更新android sdk
  2. got to android sdk folder on jenkins machines, create "licenses" folder 进入jenkins机器上的android sdk文件夹,创建“许可证”文件夹
  3. created file named "android-sdk-license" and paste the license from dev machine 创建了名为“ android-sdk-license”的文件,并从开发机粘贴了许可证

#5楼

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 您可以使用位于以下位置的SDK管理器: $ANDROID_SDK_ROOT/tools/bin

eg on linux: 例如在linux上:

cd ~/Library/Android/sdk/tools/bin/

Run the sdkmanager as follows: 如下运行sdkmanager:

./sdkmanager --licenses

eg on Windows: 例如在Windows上:

cd /d "%ANDROID_SDK_ROOT%/tools/bin"

Run the sdkmanager as follows: 如下运行sdkmanager:

sdkmanager --licenses

And accept the licenses you did not accept yet (but need to). 并接受您尚未接受(但需要接受)的许可证。

For more details see the Android Studio documentation , although the current documentation is missing any description on the --licenses option. 有关更多详细信息,请参阅Android Studio文档 ,尽管当前文档缺少--licenses选项的任何描述。

Warning 警告

You might have two Android SDKs on your machine. 您的计算机上可能有两个Android SDK。 Make sure to check both ~/Library/Android/sdk and /usr/local/share/android-sdk ! 确保同时检查~/Library/Android/sdk/usr/local/share/android-sdk If unsure, fully uninstall Android Studio from your machine and start with a clean slate. 如果不确定,请从您的计算机上完全卸载 Android Studio,然后从头开始。

Update: ANDROID_HOME is deprecated, ANDROID_SDK_ROOT is now the correct variable 更新:ANDROID_HOME已被弃用,ANDROID_SDK_ROOT现在是正确的变量


#6楼

Go to your $ANDROID_HOME/tools/bin and fire the cmd 转到您的$ANDROID_HOME/tools/bin并启动cmd

./sdkmanager --licenses

Accept All licenses listed there. 接受此处列出的所有许可证。

After this just go to the licenses folder in sdk and check that it's having these five files: 之后,只需转到sdk中的licenses文件夹,并检查其中是否包含以下五个文件:

android-sdk-license, android-googletv-license, android-sdk-preview-license, google-gdk-license, mips-android-sysimage-license

Give a retry and build again, still jenkins giving 'licenses not accepted' then you have to give full permission to your 'sdk' directory and all it's parent directories. 进行重试并再次构建,仍然是詹金斯(Jenkins)给出“不接受许可证”,那么您必须对“ sdk”目录及其所有父目录授予完全许可。 Here is the command: 这是命令:

sudo chmod -R 777 /opt/

If you having sdk in /opt/ directory. 如果您在/ opt /目录中有sdk。

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值