Can't accept license agreement Android SDK Platform 24

184,367

Solution 1

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

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

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

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

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

enter image description here

Share:
184,367
Daneye
Author by

Daneye

Updated on July 18, 2022

Comments

  • Daneye
    Daneye almost 2 years

    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.

  • Daneye
    Daneye over 7 years
    Hey Mike, from what directory what I execute those commands? Thanks!
  • Mike
    Mike over 7 years
    Working directory shouldn't matter, as long as the $ANDROID_SDK environment variable is defined. This may also be $ANDROID_HOME. One of those should be defined; It is the location of the android SDK. You can type 'printenv' and search through the defined variables to find it. Or just 'echo $ANDROID_HOME' to see if it's set. This is assuming linux... windows you would reference the environment variables by %ANDROID_SDK% instead of $ANDROID_SDK.
  • Arno van Oordt
    Arno van Oordt over 7 years
    Along with the error Cordova will echo the path to ANDROID_HOME (in case you can't find it)! If ANDROID_HOME is not set you can set it manually like this set ANDROID_HOME="C:\Users\*YOUR_USER_NAME*\AppData\Local\Androi‌​d\sdk" and the execute the above commands.
  • David Douglas
    David Douglas over 7 years
    Using Android Studio and installing Android version 24 fixed this issue for me.
  • Yonatan Kogan
    Yonatan Kogan over 7 years
    I don't see an attached image, but this worked for me too. There's a button in Android Studio for SDK Manager, and then you can open a standalone SDK manager which will let you pretty easily download all the android 24 stuff
  • HalfWebDev
    HalfWebDev over 7 years
    Despite sdk build tools 24 installed. my issue was not resolved on mac machine. Solved this by manually creating licences folder and file android-sdk-license as explained above
  • CarbonMan
    CarbonMan over 7 years
    I also tried installing from the SDK manager and it did not resolve the issue. Mike's solution did.
  • BruS
    BruS over 7 years
    Again I faced same issue when installing using cordova build in another pc with windows 7 os. This time I had build tools 24 already installed. So followed steps mentioned by Feyyaz below. That is installing Android 7.0 (API 24) and worked. So I feel latest cordova greater than 6 version needs API 24 with build tool 24 or higher version. But I didn't found any documentation for this on their website.
  • Tony Laidig
    Tony Laidig over 7 years
    on MacOS and Linux the SDK manager is at $ANDROID_HOME/tools/android
  • Gant Laborde
    Gant Laborde about 7 years
    Works great. One thing I noticed is that I apparently have 2 different versions of the SDK on my machine, so when I'd accept the license of one, my ANDROID_HOME was the other. So this fixes it, but the problem is a bit deeper and needs to be fixed, too.
  • Hugo H
    Hugo H almost 7 years
    Note: don't forget to adjust android version to SDK platform missing
  • Aaron
    Aaron almost 7 years
    I did this, but I probably could've saved a bit of time by clicking "Show Package Details" and selecting only the SDK, rather than installing Google APIs and Source as well.
  • B Faley
    B Faley over 6 years
    Adding targetSdkVersion to config.xml file fixed my problem. Thank you :)
  • Roel
    Roel over 6 years
    Tthis is also great if you have a build server that has to auto download sdk's.
  • Tyler Chong
    Tyler Chong over 6 years
    On Mac, the sdk is in /Library/Android/
  • Paul
    Paul over 6 years
    Looks like another UID is needed for platform and build-tools: d56f5187479451eabf01fb78af6dfcb131a6481e. 8933bad161af4178b1185d1a37fbf41ea5269c55 still works for Google Repository and Android Support Repository.
  • Giovanni
    Giovanni over 6 years
    I've tried everything, but for me it is still not working.
  • Trevor
    Trevor over 6 years
    Worked great for android 26 and 27 as well. Had the same issue but it happened when my cordova updated gradle from 4.0 to 4.1
  • Heemanshu Bhalla
    Heemanshu Bhalla about 6 years
    @PuneetKumar this command is not working for me. i have sdkmanager.bat file in tools/bin folder
  • Stephen Kennedy
    Stephen Kennedy about 6 years
    The same info has been posted multiple times already. How does yours improve on the existing answers?
  • PlayHardGoPro
    PlayHardGoPro about 6 years
    I get permission denied (even with sudo). If I try to execute the command with sudo su, then it says >file or directory not found.
  • PlayHardGoPro
    PlayHardGoPro about 6 years
    I Tried that and I get Couldn't load neither find main class com.android.sdklib.tool.SdkManagerCli. Ideas?
  • Lakshitha Ruwan
    Lakshitha Ruwan about 6 years
    This might be helpful stackoverflow.com/questions/40718487/…. you can try run './SdkManagerCli' inside /sdklib/tools folder.
  • Mike
    Mike about 6 years
    Strange, I suppose you don't have write permission to the directory. Try "sudo chmod -R 777 %ANDROID_HOME%\licenses"
  • Jur P
    Jur P almost 6 years
    Weeks has passed since my last build. re-building my app again I experienced the same issue above but solves it after doing this solution.
  • Niladri Banerjee - Uttarpara
    Niladri Banerjee - Uttarpara almost 6 years
    @Mike its showing me: mkdir: cannot create directory ‘/licenses’: Permission denied
  • Niladri Banerjee - Uttarpara
    Niladri Banerjee - Uttarpara almost 6 years
    in linux -- bash: /tools/bin/sdkmanager: No such file or directory
  • Peter Mounce
    Peter Mounce over 5 years
    Do you have a way of executing that non-interactively?
  • Justin
    Justin over 4 years
    None of the command line stuff worked for me on Windows, but going to Tools -> SDK and downloading another SDK prompts you to accept licenses.
  • Rahmat Ali
    Rahmat Ali over 4 years
    If windows users are getting an error. Try sdkmanager --licenses && sdkmanager --update and accept the licenses manually.
  • Pushpak Sharma
    Pushpak Sharma about 4 years
    For macOs user go to /Users/USERNAME/Library/Android/sdk/tools/bin and yes | ./sdkmanager --licenses. and ./sdkmanager --help to know more.
  • Ahsan Ahmed
    Ahsan Ahmed about 4 years
    open cmd as administrator
  • mRyan
    mRyan almost 4 years
    yes | $ANDROID_HOME/tools/bin/sdkmanager --licenses should be noninteractive.
  • kubi
    kubi over 2 years
    In case you installed the SDK via your package manager (like me on Arch), $ANDROID_HOME might be owned by root. My quick workaround was to run sudo …/sdkmanager --licenses, instead of chown'ing the whole folder.
  • andreszs
    andreszs over 2 years
    I can confirm that this answer works perfectly with the standalone Android SDK Manager, thanks.
  • user959690
    user959690 over 2 years
    Man I wish this solution worked. Command runs fine but doesn't fix the error.