ionic

You have not accepted the license agreements of the following SDK components

This tutorial guides you on how to fix the error You have not accepted the license agreements of the following SDK components while using Gradle or Cordova to build the project.

You have not accepted the license agreements of the following SDK components

When I was trying to build the app using Gradle, the build failed with the following exception.

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

BUILD FAILED

You can solve the above error by accepting the license agreements from the command line as shown below.

First, you need to get to the following path “ANDROID_SDK_ROOT/tools/bin” where SDK manager is installed.

In Windows machine, you need run the following command from cmd prompt.

cd /d "%ANDROID_SDK_ROOT%/tools/bin"

Then run the sdkmanager as shown below.

> sdkmanager --licenses

6 of 6 SDK package licenses not accepted. 100% Computing updates...
Review licenses that have not been accepted (y/N)? y

.....
.....
.....
Accept? (y/N): y
All SDK package licenses accepted

Similarly, in Linux machine, try to locate sdkmanager and get to that bin directory.

$ cd ~/Library/Android/sdk/tools/bin/

After that, run the sdkmanager to accept all the licenses as shown below.

$ ./sdkmanager --licenses

After accepting all SDK package licenses now try to do a gradle build or ionic cordova build. While building it would check the license for package Android SDK Platform 26 in the following directory C:/Users/../AppData/Local/Android/Sdk/licenses.

Also you can see the message License for package Android SDK Platform 26 accepted. And finally the build will be generated successfully.

That’s it the error should go away. Hope it helped 🙂

References:

guest
0 Comments
Inline Feedbacks
View all comments