RC1 upgrade: ionic platform add android fails


#1

After upgrading to RC1 " ionic platform add android" fails with these 2 errors:

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

and

Failed to install ‘cordova-plugin-console’:Error: /home/project_dir/platforms/android/gradlew: Command failed with exit code 1
at ChildProcess.whenDone (/home/project_dir/platforms/android/cordova/node_modules/cordova-common/src/superspawn.js:169:23)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:877:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)

Error: /home/project_dir/platforms/android/gradlew: Command failed with exit code 1

Any ideas how to fix it?

Thanks!


#2

I am also having the same issue… any one can help?


#3

I just created completely new project:

ionic start --v2 myApp

I upgraded app-scripts to the latest version: 0.0.39

npm install @ionic/app-scripts@latest

I ran ionic serve . It worked without any problems except that I couldn’t see sources in Developers tools of chrome browser (???)

After that I ran ionic platform add android and got exactly the same problem.

Please notice I didn’t do any changes to the created project, which means one of the 3 things:

  1. Something is wrong with my environment;
  2. There is inherent problem in RC1 build process;
  3. Something is missing in the documentation, since I’ve been following all written instructions.

This is my environment info:

Your system information:

    Cordova CLI: 6.4.0
    Gulp version:  CLI version 3.9.1
    Gulp local:   Local version 3.9.1
    Ionic Framework Version: 2.0.0-rc.1
    Ionic CLI Version: 2.1.4
    Ionic App Lib Version: 2.1.2
    Ionic App Scripts Version: 0.0.39
    OS: Distributor ID:	Ubuntu Description:	Ubuntu 14.04.5 LTS 
    Node Version: v6.9.1

What am I missing?


#4

I opened an issue:


#5

How is this an Ionic problem? The error message is telling you exactly what you need to do. Complete your Android SDK installation, including accepting the license agreements.


#6

I think it is Ionic problem because:

  1. I’ve completed my Android SDK installation long time ago and it worked perfectly fine before migration to RC1; Do I need to install different version of Android SDK? If yes, should it be mentioned in the documentation?
  2. If you haven’t notice, there is another problem with cordova-plugin-console, which also never happened before migration. I have Cordova installed. Should I install this plugin separately? If yes, should it be mentioned in the documentation?

#7

This is issue with cordova latest release with Android 24. So downgrade your cordova from 6.4.0 to 6.0.0 will solve this issue.

npm install -g cordova@6.0.0

It is not ionic issue.


#8

Thanks @sudhakar183! I’ll try.

And it is Ionic issue - Ionic documentation issue. Ionic development stack is huge and putting together all correct versions is excruciating There are a lot of problems caused by having wrong version of this or that. Sometimes it takes hours, if not days to understand what went wrong.
It’d be very nice if Ionic team could come up with the list of required versions for every peace of software that you have to install in order to run Ionic.

Any progress with Android SDK issue?


#9

try this command:
android update sdk --no-ui --filter build-tools-24.0.0,android-24,extra-android-m2repository
and then you redo an ionic platform add android


#10

Upgrading Android SDK to platform 24 solved both problems.
Ionic Team, please add Android SDK platform 24 as pre-requisite to RC installation.


#11

works for me :slight_smile:

Thanks


#12

How I solve the above problems with the Android SDK update all 24 and follow all directives of @skydive :). and it has been successfully working. Thank you to all of you


#13

thanks this solution help me