You have not accepted the license agreements of the following SDK components
AndroidAndroid StudioGradleAndroid Sdk-ToolsAndroid Problem Overview
I downloaded the latest Android SDK tools version 24.4.1. I used the command line to install SDKs. I typed y
when asked
> Do you accept the license 'android-sdk-license-c81a61d9' [y/n]: y after that install succeeded.
But when using Gradle 3.1 to build, the follows shows up > 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
I checked ~/.android
and /opt/android-sdk
where Android tools are put. Neither contain folder named licenses
.
Android Solutions
Solution 1 - Android
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
e.g on linux:
cd ~/Library/Android/sdk/tools/bin/
Run the sdkmanager as follows:
./sdkmanager --licenses
e.g on Windows:
cd /d "%ANDROID_SDK_ROOT%/tools/bin"
Run the sdkmanager as follows:
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.
Warning
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.
> Update: ANDROID_HOME is deprecated, ANDROID_SDK_ROOT is now the correct variable
Solution 2 - Android
You can install and accept the license of the SDK & tools via 2 ways:
1. Open the Android SDK Manager GUI via command line
Open the Android SDK manager via the command line using:
# 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
.
> Select and install the required tools. (your location may be different)
2. Install and accept android license via command line:
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.
# 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
25.0.1
, 24.0.1
, 23.0.1
)
- Install a specific version (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
Solution 3 - Android
Go to your $ANDROID_HOME/tools/bin
and fire the 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:
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. Here is the command:
sudo chmod -R 777 /opt/
If you having sdk in /opt/ directory.
Solution 4 - Android
I have resolved the problem by using the command:
> 1. Go to: C:\Users\ [PC NAME] \AppData\Local\Android\sdk\tools\bin\ (If the folder is not available then download the Android SDK first, or > you can install it from the android studio installation process.) > 2. Shift+Left click and Press W, then Enter to open CMD on the folder path > 3. Type in the cmd: sdkmanager --licenses > 4. Once press enter, you need to accept all the licenses by pressing y
Checking the licenses
> 1. Go to: C:\Users\ [PC NAME] \AppData\Local\Android\sdk
> 2. Check the folder named licenses
android-googletv-license
android-sdk-license
android-sdk-preview-license
google-gdk-license
intel-android-extra-license
mips-android-sysimage-license
AS NEW UPDATE FOLDER PATH (Current Android Studio)
Open Android Studio, Tools > Sdk Manager > Android SDK Command-Line Tools (Just Opt-in)
SDKManager will be store in :
> 1. Go to C:\Users\ [PC NAME] \AppData\Local\Android\Sdk\cmdline-tools\latest\bin > 2. Type in the cmd: sdkmanager --licenses
Documentation to using the Android SDK: https://developer.android.com/studio/command-line/sdkmanager.html
Solution 5 - Android
For Windows users w/o using Andoid Studio:
-
Go to the location of your
sdkmanager.bat
file. Per default it is atAndroid\sdk\tools\bin
inside the%LOCALAPPDATA%
folder. -
Open a terminal window there by typing cmd into the title bar
-
Type
sdkmanager.bat --licenses
-
Accept all licenses with 'y'
Solution 6 - Android
Update for macOS Sierra 10.12.6 - Android Studio for Mac 2.3.3
Locate the sdkmanager file usually under:
/Users/YOUR_MAC_USER/Library/Android/sdk/tools/bin
./sdkmanager --licenses
Warning: File /Users/mtro.josevaler**strong text**io/.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
To validate the problem has gone just repeat the operation involved in the license issue.
Solution 7 - Android
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).
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.
Solution 8 - Android
Maybe I'm late, but this helped me accept SDK licenses for OSX,
If you have android SDK tools installed, run the following command
~/Library/Android/sdk/tools/bin/sdkmanager --licenses
Accept all licenses by pressing y
Voila! You have accepted SDK licenses and are good to go..
Solution 9 - Android
If you want to use the IDE to accept the license, I also found it easy to open up Android Studio and create a new basic project to trigger the license agreements. Once I created a project, the following licensing dialog was presented that I needed to agree to:
I documented fully the information in the following post: Accepting the Android SDK License via Android Studio
Solution 10 - Android
I had a similiar problem but ./sdkmanager --licenses didnt work. I follow this thread and "obladors" comment gave me the solution: https://github.com/oblador/react-native-vector-icons/issues/527
What eventually solved my problem was:
Running ./sdkmanager "build-tools;23.0.1"
Change 23.0.1 with your version
Solution 11 - Android
You can accept the license agreement by launching Android Studio, then going to:
> Help > Check for Updates...
When you are installing updates, it'll ask you to accept the license agreement. Accept the license agreement and install the updates, and you are all set.
Solution 12 - Android
I ran across this error when i ran cordova build android
I solved this issue by firing ./sdkmanager --licenses and accepting all the licenses.
- You have a sdkmanager.bat under the android sdk folder in the path: android/sdk/tools/bin
- To trigger that open a command prompt in android/sdk/tools/bin
- type ./sdkmanager --licenses and enter
- Press y to review all licenses and then press y to accept all licenses
Solution 13 - Android
In linux
1. Open a terminal
2. Write: "cd $ANDROID_HOME/tools/bin (this path can be /home/your-user/Android/Sdk/tools/bin)"
3. Write: "./sdkmanager --licenses"
4. To accept All licenses listed, write: "y"
5. Ready!
If your are building an app with Ionic Framework, just write again the command to build it.
Solution 14 - Android
If you are having this problem for a React Native app, in addition to above mentioned steps, make sure you have the local.properties file in the android directory(AppName/android) of your app which points to your 'sdk' directory:
sdk.dir=/PATH_TO_SDK/
Solution 15 - Android
I have resolved the issue by below steps:
- update the android sdk with command "tools/android update sdk --no-ui"
- got to android sdk folder on jenkins machines, create "licenses" folder
- created file named "android-sdk-license" and paste the license from dev machine