[android] You have not accepted the license agreements of the following SDK components

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.

This question is related to android android-studio gradle android-sdk-tools

The answer is


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.


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

- Install a specific version (25.0.1, 24.0.1, 23.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

I ran across this error when i ran cordova build android

I solved this issue by firing ./sdkmanager --licenses and accepting all the licenses.

  1. You have a sdkmanager.bat under the android sdk folder in the path: android/sdk/tools/bin
  2. To trigger that open a command prompt in android/sdk/tools/bin
  3. type ./sdkmanager --licenses and enter
  4. Press y to review all licenses and then press y to accept all licenses

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


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..


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


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.


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/

I have resolve 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

WAS TESTED ON CORDOVA USING THE COMMAND:

cordova build android

-- UPDATE NEW FOLDER PATH --

Open Android Studio, Tools > Sdk Manager > Android SDK Command-Line Tools (Just Opt-in)

enter image description here

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


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:

enter image description here

I documented fully the information in the following post: Accepting the Android SDK License via Android Studio


For Windows users w/o using Andoid Studio:

  1. Go to the location of your sdkmanager.bat file. Per default it is at Android\sdk\tools\bin inside the %LOCALAPPDATA% folder.

  2. Open a terminal window there by typing cmd into the title bar

  3. Type

    sdkmanager.bat --licenses
    
  4. Accept all licenses with 'y'


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.


I have resolved the issue by below steps:

  1. update the android sdk with command "tools/android update sdk --no-ui"
  2. got to android sdk folder on jenkins machines, create "licenses" folder
  3. created file named "android-sdk-license" and paste the license from dev machine

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.


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.


Examples related to android

Under what circumstances can I call findViewById with an Options Menu / Action Bar item? How to implement a simple scenario the OO way My eclipse won't open, i download the bundle pack it keeps saying error log getting " (1) no such column: _id10 " error java doesn't run if structure inside of onclick listener Cannot retrieve string(s) from preferences (settings) strange error in my Animation Drawable how to put image in a bundle and pass it to another activity FragmentActivity to Fragment A failure occurred while executing com.android.build.gradle.internal.tasks

Examples related to android-studio

A failure occurred while executing com.android.build.gradle.internal.tasks "Failed to install the following Android SDK packages as some licences have not been accepted" error Android Gradle 5.0 Update:Cause: org.jetbrains.plugins.gradle.tooling.util This version of Android Studio cannot open this project, please retry with Android Studio 3.4 or newer WARNING: API 'variant.getJavaCompile()' is obsolete and has been replaced with 'variant.getJavaCompileProvider()' Flutter plugin not installed error;. When running flutter doctor ADB.exe is obsolete and has serious performance problems Android design support library for API 28 (P) not working Flutter command not found How to find the path of Flutter SDK

Examples related to gradle

Gradle - Move a folder from ABC to XYZ A failure occurred while executing com.android.build.gradle.internal.tasks Gradle: Could not determine java version from '11.0.2' Android Gradle 5.0 Update:Cause: org.jetbrains.plugins.gradle.tooling.util Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0 Failed to resolve: com.android.support:appcompat-v7:28.0 Failed to resolve: com.google.firebase:firebase-core:16.0.1 com.google.android.gms:play-services-measurement-base is being requested by various other libraries java.lang.NoClassDefFoundError:failed resolution of :Lorg/apache/http/ProtocolVersion Error - Android resource linking failed (AAPT2 27.0.3 Daemon #0)

Examples related to android-sdk-tools

"Failed to install the following Android SDK packages as some licences have not been accepted" error Flutter does not find android sdk Failed to run sdkmanager --list with Java 9 You have not accepted the license agreements of the following SDK components Automatically accept all SDK licences Android SDK location should not contain whitespace, as this cause problems with NDK tools Finding Android SDK on Mac and adding to PATH Android SDK folder taking a lot of disk space. Do we need to keep all of the System Images? Daemon not running. Starting it now on port 5037 libz.so.1: cannot open shared object file