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 🙂
- Create components inside a specific folder with Angular 9 CLI ?
- Best way to delete components in Angular 9 with CLI
- Get index of ngFor element using index as value in attribute
- Set default value in the dropdown list in Angular 9
- Dynamic and conditional CSS classes with ngClass : Angular
- Best way to delete components in Angular 9 with CLI ?
- HTML Property Binding in Angular : Data Binding
- Quickly create div classes in Visual Studio Code editor
- Global Angular CLI version is greater than your local version
- Create custom events and fire in Angular 9 with EventEmitter – Example
- ERROR in multi /bootstrap.min.css ./src/styles.css in Angular 9
- Bind selected element from drop down to an object in Angular 9
- Angular 9 Error : ‘app-header’ is not a known element
- Create common app-header component in Angular 9
- How to stop generation of .spec.ts test files using Angular CLI ?
- Emmet in Visual Studio Code not working ?
- Create a Simple HTTP Server in Java/Socket – Example
- Run ionic app in android studio emulator ?