Ionic build error : You have not accepted the license agreements of the following SDK components: [Android SDK Platform 24]

63,729

Solution 1

Install Platform 24 (Android 7) solved this problem

Solution 2

Install the license:

mkdir "%ANDROID_HOME%\licenses"

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

Solution 3

In Command Prompt, go to ANDROID_HOME\tools\bin

Then run the command, sdkmanager --licenses

Accept the licenses you want when it is prompted.

Solution 4

I solved it by installing the Android SDK Platform 24 without the Android SDK manager.

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

*Cordova CLI 6.4.0 / Windows 10

Solution 5

  1. Go to C:\Users\<UserName>\AppData\Local\Android\Sdk\tools\bin
  2. Run command ./sdkmanager.bat --licenses
  3. accept license

Worked for me

Share:
63,729
Amit Singh
Author by

Amit Singh

Updated on July 04, 2020

Comments

  • Amit Singh
    Amit Singh almost 4 years

    I'm trying to run the command ionic build android --release to build the apk but i am getting this error

    Total time: 1.767 secs Error: cmd: Command failed with exit code 1 Error output: FAILURE: Build failed with an exception.

    • What went wrong: A problem occurred configuring root project 'android'.

      You have not accepted the license agreements of the following SDK components: [Android SDK Platform 24]. 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

    • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Picked up _JAVA_OPTIONS: -Xmx512M

  • Eric Gopak
    Eric Gopak over 7 years
    Worked for Cordova CLI 6.4.0 / Windows 8.1 :) Thanks!
  • mpsyp
    mpsyp over 7 years
    I have no %ANDROID_HOME% environment variable. Tried using %ADT_HOME% instead, no luck. I'm on Win7. Any thoughts?
  • mpsyp
    mpsyp over 7 years
    installed 24 with SDK manager, no luck. I've never had this problem before, just started after uninstalling and reinstalling Ionic+Cordova, etc. Builds worked fine before. Why is it showing up now?
  • Marvin Thobejane
    Marvin Thobejane over 7 years
    Just add the image to his answer as this is not a separate solution
  • Koushik Sarkar
    Koushik Sarkar over 7 years
    @mpsyp After Peter Wang's solution when I started the build again I saw android 25 was installed and build succeeded. So maybe installing android 25 may solve the issue.
  • Peter.Wang
    Peter.Wang about 7 years
    @mpsyp ANDROID_HOME is your android SDK location. If you don't have it in the windows environment variable, create one and pointing to the folder contains the android sdk package.
  • Travis Don Kindred
    Travis Don Kindred about 7 years
    This does not always work. The solution by Peter Wang bypasses the possibility of error while the license is still valid.
  • bruno-martins
    bruno-martins about 7 years
    This worked for me! Tried both solutions above without success.
  • wahmal
    wahmal about 7 years
    How to do it on windows 7 ?
  • Abhay Shiro
    Abhay Shiro almost 7 years
    This is a good answer. Also please make sure that your android-sdk folder has READ/WRITE permissions given.
  • spencer
    spencer almost 7 years
    worked for me on Linux. If you don't want to use only command line, make a folder called licenses in Android/sdk/, make the file android-sdk-license, copy 8933bad161af4178b1185d1a37fbf41ea5269c55. Thanks Pete!
  • vivanov
    vivanov over 6 years
    In my case it was only enough to add ANDROID_HOME environment variable, as the license was already there.
  • Roger Garcia
    Roger Garcia almost 6 years
    At step 1 you forgot "AppData" between username and local (so the path is C:\Users\<UserName>\AppData\Local\Android\Sdk\tools\bin), and at step 2, the command I had to execute was ./sdkmanager.bat --licenses. With that, I was able to build for android without issues. Thanks for your help. If you accept the edit I send, I think this should be the accepted answer. It focus exactly on where the problem was and solves it.