You have not accepted the license... Android SDK Platform 26


#1

I’m updating a 6 months old project, and getting this error when I use: ionic package build android


λ ionic package info 90
√ Retrieving information about build 90 - done!

id | 90
status | FAILED
platform | Android
mode | debug
profile |
started | 2017-11-22T20:15:07.182Z
finished |

output:
Discovered plugin “com.phonegap.plugins.barcodescanner” in config.xml. Adding it to the project
Found phonegap-plugin-barcodescanner is already fetched. Skipped fetching com.phonegap.plugins.barcodescanner
Plugin “phonegap-plugin-barcodescanner” already installed on android.
ANDROID_HOME=/opt/android-sdk
JAVA_HOME=/usr/lib/jvm/java-8-oracle
:wrapper

BUILD SUCCESSFUL

Total time: 0.77 secs
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_cms663b5k7ukq3tikhtmdf93g.run(/home/package/workspace/apps-a35e0e54-90/cordova/platforms/android/build.gradle:143)
Checking the license for package Android SDK Platform 26 in /opt/android-sdk/licenses
Warning: License for package Android SDK Platform 26 not accepted.

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

Total time: 2.138 secs
Error: /home/package/workspace/apps-a35e0e54-90/cordova/platforms/android/gradlew: 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 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.

I’ve updated Android Studio, Android SDK, npm, ionic, cordova…
and now this error about licenses… (tried other solutions given on the forum but didn’t work)

any help appreciated!


#2

ionic info gives:

λ ionic info
[WARN] Error with .\www\lib\ionic\version.json file: FILE_NOT_FOUND, trying .\bower.json.

cli packages: (C:\Users\jcmag_000\AppData\Roaming\npm\node_modules)

@ionic/cli-utils  : 1.19.0
ionic (Ionic CLI) : 3.19.0

global packages:

cordova (Cordova CLI) : 7.1.0

local packages:

Cordova Platforms : android 6.3.0 ios 4.2.0 windows 4.4.2
Ionic Framework   : ionic1 1.2.4

System:

Android SDK Tools : 26.1.1
Node              : v8.9.1
npm               : 3.8.1
OS                : Windows 10

Environment Variables:

ANDROID_HOME : D:\Android\android-sdk

Misc:

backend : legacy

#3

Do what it says in this error message.


#4

already did, I have installed the SDK from Android Studio, and accepted the licenses…


#5

Found the problem!!

in config.xml, replaced:
…engine name=“android” spec=“6.3.0” />
with:
…engine name=“android” spec=“6.2.3” />

and in package.json, replaced:
“cordova-android”: “6.3.0"
with
"cordova-android”: “6.2.3”

(from: https://ionic.zendesk.com/hc/en-us/articles/115012901127-Android-build-failure-Failed-to-install-Android-SDK-Platform-26)


#6

Hi. Today I encountered this problem as well. However, changing the engine name to 6.2.3 was not enough for me. Nor was the solution suggested here: https://stackoverflow.com/questions/40383323/cant-accept-license-agreement-android-sdk-platform-24.

What I did was download Android Studio. Then I updated the SDK version using the SDK manager provided by Android Studio (Tools/Android/SDK Manager). In the Android SDK Location click on the Edit button. There I was prompted with the option to update to API 27.

After updating, I created a new dummy android project (empty activity). After the project was created, the TODO console gave me the option to download the missing sdk components. There I was prompted with the ‘Accept licence’ popup. After accepting, I was able to build my ionic project without this error.


#7

also you can do it while adding android platform

cordova platform add android@6.2.3