Can't accept license agreement Android SDK Platform 24
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.
Daneye
Updated on July 18, 2022Comments
-
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 over 7 yearsHey Mike, from what directory what I execute those commands? Thanks!
-
Mike over 7 yearsWorking 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 over 7 yearsAlong 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\Android\sdk"
and the execute the above commands. -
David Douglas over 7 yearsUsing Android Studio and installing Android version 24 fixed this issue for me.
-
Yonatan Kogan over 7 yearsI 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 over 7 yearsDespite 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 over 7 yearsI also tried installing from the SDK manager and it did not resolve the issue. Mike's solution did.
-
BruS over 7 yearsAgain 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 over 7 yearson MacOS and Linux the SDK manager is at $ANDROID_HOME/tools/android
-
Gant Laborde about 7 yearsWorks 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 almost 7 yearsNote: don't forget to adjust android version to SDK platform missing
-
Aaron almost 7 yearsI 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 over 6 yearsAdding
targetSdkVersion
toconfig.xml
file fixed my problem. Thank you :) -
Roel over 6 yearsTthis is also great if you have a build server that has to auto download sdk's.
-
Tyler Chong over 6 yearsOn Mac, the sdk is in /Library/Android/
-
Paul over 6 yearsLooks like another UID is needed for platform and build-tools:
d56f5187479451eabf01fb78af6dfcb131a6481e
.8933bad161af4178b1185d1a37fbf41ea5269c55
still works for Google Repository and Android Support Repository. -
Giovanni over 6 yearsI've tried everything, but for me it is still not working.
-
Trevor over 6 yearsWorked 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 about 6 years@PuneetKumar this command is not working for me. i have sdkmanager.bat file in tools/bin folder
-
Stephen Kennedy about 6 yearsThe same info has been posted multiple times already. How does yours improve on the existing answers?
-
PlayHardGoPro about 6 yearsI 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 about 6 yearsI Tried that and I get
Couldn't load neither find main class com.android.sdklib.tool.SdkManagerCli
. Ideas? -
Lakshitha Ruwan about 6 yearsThis might be helpful stackoverflow.com/questions/40718487/…. you can try run './SdkManagerCli' inside /sdklib/tools folder.
-
Mike about 6 yearsStrange, I suppose you don't have write permission to the directory. Try "sudo chmod -R 777 %ANDROID_HOME%\licenses"
-
Jur P almost 6 yearsWeeks 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 almost 6 years@Mike its showing me: mkdir: cannot create directory ‘/licenses’: Permission denied
-
Niladri Banerjee - Uttarpara almost 6 yearsin linux -- bash: /tools/bin/sdkmanager: No such file or directory
-
Peter Mounce over 5 yearsDo you have a way of executing that non-interactively?
-
Justin over 4 yearsNone 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 over 4 yearsIf
windows
users are getting an error. Trysdkmanager --licenses && sdkmanager --update
and accept the licenses manually. -
Pushpak Sharma about 4 yearsFor macOs user go to /Users/USERNAME/Library/Android/sdk/tools/bin and
yes | ./sdkmanager --licenses
. and ./sdkmanager --help to know more. -
Ahsan Ahmed about 4 yearsopen cmd as administrator
-
mRyan almost 4 years
yes | $ANDROID_HOME/tools/bin/sdkmanager --licenses
should be noninteractive. -
kubi over 2 yearsIn 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 over 2 yearsI can confirm that this answer works perfectly with the standalone Android SDK Manager, thanks.
-
user959690 over 2 yearsMan I wish this solution worked. Command runs fine but doesn't fix the error.