Ionic (Cloud) Package: SDK License error

My local build works just fine but when I try to build on the cloud, I get this:

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

Again, I ran the SDK tools and verified that all license agreements are good.

Anyone else ran into this?

Thanks for the help.

What command exactly are you running?
What is your ionic info output?

I’m having the same issue.

Command: ionic package build android --prod --release --profile kwoprod

Output:

BUILD SUCCESSFUL

Total time: 0.773 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_da72lfddgmnh9vbd4lr8pvnv5.run(/home/package/workspace/apps-6beab527-100/cordova/platforms/android/build.gradle:141)
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.



8933bad161af4178b1185d1a37fbf41ea5269c55
BUILD FAILED

Total time: 1.118 secs
Error: /home/package/workspace/apps-6beab527-100/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.

That sounds like something Ionic has to take care of: http://ionicframework.com/support#support

(You might want to try to build with an older version of cordova-android - not 6.3.0 but 6.2.3. Maybe this works around this.)

I have the same problem using the Pro tool and “Package native binary”. Any feed back on this?

Create a new topic please, “Ionic Pro” is another thing.

1 Like

I have exactly the same problem, exactly the same messages.

I only had the issue when I connected to an existing project. When I created a project from withing Ionic Pro I did not have the issue.

I created a new project and moved the pages and providers from the old project to the new Ionic Pro one and everything worked.

I am sure I could sleuth it out by comparing config files, but it was a small project and this was quick.

Same issue here. Project move is not easy in my case.

How you can solve this problem as follow.
Dont ask me why it solves the problem, really dont know what the connection is between these two. But it works.

  1. Download android studio SDK Manager
  2. Download the SDK for version 26.
  3. Push your project again to the ionic cloud
  4. You will see he will pass the build

Link for step 1 download:
https://developer.android.com/studio/intro/update.html

Goodluck with it.

regarding 3. → There is nothing to push …

I heard something about a search engine called google: https://stackoverflow.com/questions/38096225/automatically-accept-all-sdk-licences/38381577

Accept the agreements with the described command.

Iknow, just change some code and push.
It will work.

Thank you! I will test it :slight_smile:

no same error.
Tbh I would have wondered why this should work, there should not be any other connection besides my desktop pc and the repo…

This worked for me, although the error is different:

Some users have reported the following error in Android package builds:

Failed to install the following SDK components:
[Android SDK Platform 26] The SDK directory (/opt/android-sdk) is not writeable, 
please update the directory permissions.

This most likely means your app has specified an unsupported version of the cordova-android platform. To avoid this, please make sure your package.json and config.xml files contain an explicit version number in the version/spec, meaning no ~ or ^ character.

For cordova-android, we recommend this in config.xml:

<engine name="android" spec="6.2.3" />

And this in package.json (in “dependencies”):

"cordova-android": "6.2.3"

Which is from here: https://ionic.zendesk.com/hc/en-us/articles/115012901127-Android-build-failure-Failed-to-install-Android-SDK-Platform-26, that is linked on the “Common build errors” page of the support pages: https://ionic.zendesk.com/hc/en-us/sections/115003490348-Common-build-errors