License issues: Android SDK Platform 26

I have downloaded the latest android studio for windows. But when I am trying to run

ionic corodova build android

it’s failing with below error.

Running app-scripts build: --platform android --target cordova
[16:08:10] build dev started …
[16:08:10] clean started …
[16:08:10] clean finished in 16 ms
[16:08:10] copy started …
[16:08:10] transpile started …
[16:08:20] transpile finished in 9.28 s
[16:08:20] webpack started …
[16:08:20] copy finished in 9.60 s
[16:08:31] webpack finished in 11.69 s
[16:08:31] sass started …
[16:08:34] sass finished in 2.39 s
[16:08:34] build dev finished in 24.16 s

cordova build android
ANDROID_HOME=C:\Users\tanmay\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_131
Subproject Path: CordovaLib
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
at build_7o7xe2pxt883tg6ritz4aewbd.run(D:\mutrade\web\web\utrade\static\utrade\HybridApp\ionic\platforms\android\build.gradle:141)
Checking the license for package Android SDK Platform 26 in C:\Users\tanmay\AppData\Local\Android\sdk\licenses

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 Exporting licenses - Android Studio Project Site

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
    Warning: License for package Android SDK Platform 26 not accepted.

BUILD FAILED

Total time: 3.447 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 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 Exporting licenses - Android Studio Project Site

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

[ERROR] An error occurred while running cordova build android (exit code 1).

As in some answers here I changed the config.xml to include

but it had no affect.

Can anybody pls help me with the error.

2 Likes

Did you had a look to https://stackoverflow.com/questions/39760172/you-have-not-accepted-the-license-agreements-of-the-following-sdk-components

2 Likes

Thanks one of the answers worked. Had to go to C:\Users\tanmay\AppData\Local\Android\Sdk\tools\bin, and run sdkmanager --licenses. Phew

6 Likes

1-install jdk
2-add java/jdk…/bin to path
3-add sdk/tools/bin to path
4-run command line and write sdkmanager --licenses
5-Download the rest of the packages by following the instructions
6-You should get the following message:
All SDK package licenses accepted.======] 100% Computing updates…

1 Like

it worked to me. thanks.