Can't accept license agreement Android SDK Platform 24

AndroidCordovaSdkLicensing

Android Problem Overview


I'm getting the following error when trying to install an android platform on a Cordova project. I've been following this guide: https://cordova.apache.org/docs/en/latest/guide/cli/

Error occurs when executing the following: $ cordova platform add android --save

> A problem occurred configuring root project 'android'. > You have not accepted the license agreements of the following SDK components: [Android SDK Platform 24].

I've searched all over for ways to accept the license agreement of Android SDK Platform 24, but no real luck.

Thank you ahead of time.

Android Solutions


Solution 1 - Android

You can also just execute

> $ANDROID_HOME/tools/bin/sdkmanager --licenses

Or for Windows execute

> %ANDROID_HOME%/tools/bin/sdkmanager --licenses

-- OR --

> C:\Users{your-username}\AppData\Local\Android\sdk\tools\bin\sdkmanager --licenses

(credit for windows command to @puneet-kumar)

Solution 2 - Android

I'm not exactly sure how cordova works, but once the licenses are accepted it creates a file. You could create that file manually. It is described on this question, but here's the commands to create the required license file.

Linux:

mkdir "$ANDROID_HOME/licenses"
echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > "$ANDROID_HOME/licenses/android-sdk-license"

Windows:

mkdir "%ANDROID_HOME%\licenses"
echo |set /p="8933bad161af4178b1185d1a37fbf41ea5269c55" > "%ANDROID_HOME%\licenses\android-sdk-license"

Solution 3 - Android

I had this problem on Mac OS X 10.12.1 with Cordova 6.4.0 and Android Studio 2.2.3.

When I installed Android Studio it installed Platform 25, but not 24. To install 24:

  • Open Android Studio.
  • Open Android Studio Menu > Preferences.
  • Appearance & Behavior > System Settings > Android SDK
  • Tick the box for Android 7.0 (Nougat) | 24
  • Click ok and follow the instructions.

Solution 4 - Android

The simplest way to solve this issue is to accept the licenses using the following command:

Windows OS:

C:\Users\{your-username}\AppData\Local\Android\sdk\tools\bin\sdkmanager --licenses

You will be presented with disclaimers. In order to continue your development efforts, you need to answer 'y' to all disclaimers.

Solution 5 - Android

I had exactly the same problem. Then i installed "Android 7.0 (API 24) > SDK Platform" and it worked.

enter image description here

Solution 6 - Android

Go to Android\sdk\tools\bin

None of the above solutions worked for me and finally this single line accepted all android licences.

yes | sdkmanager --licenses && sdkmanager --update

Solution 7 - Android

In my case I don't use the Android studio (I am using eclipse). I did the following step: Solved just by running the command

android-sdks/tools/bin$ ./sdkmanager --update

Which created a licenses directory and added a file called android-sdk-license inside it.

Then you can run (licenses option is not available unless you did the step above)

android-sdks/tools/bin$ ./sdkmanager --licenses

and accept the license (however, in my case I didn't need to do that)

Solution 8 - Android

I had the issue. You do not need to copy or to create any folder, just be careful of your SDK path. It must be the same of the environnement variable (ANDROID_HOME), which wasn't the same for me. I don't know why.

sdk location

Solution 9 - Android

I installed android sdk build-tools 24(it's current version 24.0.3) through SDK manager. Path to open SDK manager is shown in img file attached. This solved my problem SDK Manager

Solution 10 - Android

I had the Android SDK by installing the Android Studio and got this error too. There's a simple solution from the user guide.

  1. On a machine with Android Studio installed, click Tools > Android > SDK Manager. At the top of the window, note the Android SDK Location.

  2. Navigate to that directory and locate the licenses/ directory inside it.

    (If you do not see a licenses/ directory, return to Android Studio and update your SDK tools, making sure to accept the license agreements. When you return to the Android SDK home directory, you should now see the directory.)

  3. Copy the entire licenses/ directory and paste it into the Android SDK home directory on the machine where you wish to build your projects.

Solution 11 - Android

This error can come if the system is not picking up the ANDROID_HOME environmental variable from the proper path. Make sure you have installed the Android SDK and have set the ANDROID_HOME variable properly to the appropriate path as in the below image:

ANDROID_HOME_PATH

If the ANDROID_HOME variable is not defined, the system tries to pick the path from a default path(this might not be the path where the Android SDK is defined, leading to this issue).

Solution 12 - Android

Prerequisites

Answer

  • Go to C:\Users\{user}\AppData\Local\Android\sdk\tools\bin (Your android SDK Tools folder)

  • Run sdkmanager --licenses

  • It'll ask you to accept whatever the agreements remaining to be accepted. you'll just have to type "y" and enter.

  • Will solve the issue

Solution 13 - Android

Install the following component:

enter image description here

Solution 14 - Android

I am using Mac and I resolved it using this command:

$ which sdkmanager
/usr/local/bin/sdkmanager
$ /usr/local/bin/sdkmanager --licenses
Warning: File /Users/user/.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

Then I had a list of 6 licenses to accept and its resolved after that.

Solution 15 - Android

It is because by default at the time of this writing , Ionic CLI tool is defaulted to

<preference name="android-targetSdkVersion" value="LATEST_SDK_VERSION"/> 

That is the reason why it complains that you did not accept license agreement , but in reality you did not install the SDK packages for that API Level yet alone accept the license.

So what you need to do is either

  1. Change Your target SDK version
  2. Install latest SDK API level from SDK Manager

Changing your SDK version

You can do it manually and even verify it by running

ionic cordova platform add android 

the file can be found at your-awesome-app/config.xml open it and add this line , since its hidden as stated above

<preference name="android-targetSdkVersion" value="24"/>

If you are not sure which API LEVEL Number you are targeting open SDK Manager and look at the API levels (Numbers) available on your machine

Installing Latest SDK Package

You can add the current SDK Packages which the CLI is showing , Which in your case it is 24

Run SDK MANAGER as Admin

Run SDK Manager as Admin

Install the SDK API Packages which you are targeting

Thats where the SDK API level are written

How did I know this? I did it this morning and that's how I solved it and now am playing Sticky Bubble on Android to relax a bit.

Happy Deploying!

Solution 16 - Android

In my case (Dockerfile script to build an Android CI container - https://github.com/menny/docker_android), I had to do these steps:

mkdir ~/.android && touch ~/.android/repositories.cfg
yes | sdkmanager --licenses
sdkmanager "build-tools;26.0.0"
sdkmanager "platform-tools" "tools"
sdkmanager "platforms;android-26" "platforms;android-25" "platforms;android-24"
.....
sdkmanager --update
yes | sdkmanager --licenses

Two notes:

  1. Had to create an empty repositories.cfg file or sdkmanager would die.
  2. Had to perform the fetching/installing of packages in different calls, since there is no progress indication.

Solution 17 - Android

You can also follow the "official" way. Run "sdkmanager --licenses" within tools/bin folder of Android SDK installation and accept all licenses. Done!

c:\android-sdk\tools\bin>sdkmanager --licenses

For macOS or Linux it's the same command.

Solution 18 - Android

> It needs a latest stable sdk-platform installed. I installed SDK-Platform from API 25. It fixed my problem.See Screenshot below

Solution 19 - Android

I had to update the android sdk

android update sdk --no-ui

at some point it will ask you for license agreement, press y. After that you need to remove the angular platform.

Solution 20 - Android

  1. Go to Android SDK location

> C:\Users\username\AppData\Local\Android\sdk\tools\bin

  1. Run command sdkmanager --licenses

  2. Accept the licence for SDK

Solution 21 - Android

This issue is surfacing when already an old version of SDK Manager is in the machine from where the approach of Android build is Changed which requires "android studio". I faced this in Visual Studio that was repeatedly halted with Error Message, "You have not accepted the License for version 25". The solution for this is "Install the Android Studio" and then "go to Environment Variables" and set the ANDROID_HOME to "C:\Users<username>\AppData\Local\Android\Sdk" (This path can be picked from Android Studio, Menu >> Tools >> SDK Manager. Also use the same in "path" of Environment Variables. This way, the new SDK manager is mapped for pickup by Visual Studio Build for Cordova Application.

This just took my 2 days effort second time

Wish others don't waste their time in this mess.

Solution 22 - Android

Changing the target build might work as referenced here

If you want to specify the SDK version you can do so by adding the following line to your config.xml in the root of your ionic / cordova project

<preference name="android-targetSdkVersion" value="23"/>

Solution 23 - Android

you need to manually re-install sdk this help me: https://forum.ionicframework.com/t/you-have-not-accepted-the-license-agreements-of-the-following-sdk-component/69570/6

"android update sdk --no-ui --filter build-tools-24.0.0,android-24,extra-android-m2repository"

Solution 24 - Android

Hope this will work for someone out there
I was facing the same issue! I had 2 sdks, named as sdk and sdk1. It was default linked to sdk but the working one was sdk1. So I went to Environment Varaible and added ANDROID_HOME and path of the sdk1, i.e. in my case was C:\Users\tripa_000\AppData\Local\Android\sdk1 , and it solved my problem!

Solution 25 - Android

For me I was Building the Ionic using "ionic build android" command and I was getting the same problem! The solution was simply

  • To install the required sdk
  • Run the same command in CMD must be as administrater

Solution 26 - Android

I just ran into this issue, and what solved it for me on windows, you are using command line, and you recently installed the android sdk, you must restart Command Prompt or Power Shell after you install the android sdk.

Solution 27 - Android

Mike's answer works.But need to put the generated license under C:\Users\user\AppData\Local\Android\sdk\licenses.

Solution 28 - Android

its mean miss match Android SDK version of cordova with the version you installed. For an example cordova support Android SDK 24 but you don't have Android sdk 24. it may be reverse.

Solution 29 - Android

This will update your android SDK and accept the license in the same time (ex for Android 25):

android update sdk --no-ui --filter build-tools-25.0.0,android-25,extra-android-m2repository

Solution 30 - Android

The problem for me was that my ANDROID_HOME variable was being set to another installation I forgot existed. If this is your problem, delete the old installation.

Solution 31 - Android

install Android 7 - Platform 24 Full in android sdk manager

just it

Solution 32 - Android

If you want to avoid creating the licence folder manually, and in case your sdk is not in the "Users/User" you can go to android studio => Configure => SDK Manager and install any component, i installed the google usb driver from the sdk tools, it automatically generated the license in the correct location.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionDaneyeView Question on Stackoverflow
Solution 1 - AndroidHardik PatelView Answer on Stackoverflow
Solution 2 - AndroidMikeView Answer on Stackoverflow
Solution 3 - AndroidjxmallettView Answer on Stackoverflow
Solution 4 - AndroidFull ArrayView Answer on Stackoverflow
Solution 5 - AndroidfeyyazView Answer on Stackoverflow
Solution 6 - AndroidvishwarajView Answer on Stackoverflow
Solution 7 - AndroidBeeZoneView Answer on Stackoverflow
Solution 8 - AndroidJohnView Answer on Stackoverflow
Solution 9 - AndroidBruSView Answer on Stackoverflow
Solution 10 - AndroidJava XuView Answer on Stackoverflow
Solution 11 - AndroidKrishna_AnipindiView Answer on Stackoverflow
Solution 12 - AndroidLakshitha RuwanView Answer on Stackoverflow
Solution 13 - AndroidSumant SinghView Answer on Stackoverflow
Solution 14 - AndroidNeelView Answer on Stackoverflow
Solution 15 - AndroidFahadView Answer on Stackoverflow
Solution 16 - AndroidMennyView Answer on Stackoverflow
Solution 17 - AndroidGeorgy KView Answer on Stackoverflow
Solution 18 - AndroidTushar WalzadeView Answer on Stackoverflow
Solution 19 - AndroidTasnim RezaView Answer on Stackoverflow
Solution 20 - AndroidInder malviyaView Answer on Stackoverflow
Solution 21 - Androidekambar kodaliView Answer on Stackoverflow
Solution 22 - AndroidMadhu KumarView Answer on Stackoverflow
Solution 23 - AndroidYevhen Kotliar View Answer on Stackoverflow
Solution 24 - AndroidTripathee GauravView Answer on Stackoverflow
Solution 25 - AndroidAdelView Answer on Stackoverflow
Solution 26 - AndroidNorman BreauView Answer on Stackoverflow
Solution 27 - AndroidThyagarajan CView Answer on Stackoverflow
Solution 28 - AndroidYusufView Answer on Stackoverflow
Solution 29 - AndroidYann UlrichView Answer on Stackoverflow
Solution 30 - AndroidCilanView Answer on Stackoverflow
Solution 31 - AndroidAli GhView Answer on Stackoverflow
Solution 32 - AndroidMozart AlKhateebView Answer on Stackoverflow