Ionic-cli: platforrms/android not added after adding crosswalk, ionic run android fails

Created on 14 Jan 2015  Â·  27Comments  Â·  Source: ionic-team/ionic-cli

I did the following:

  1. ionic start my_app
  2. cd my_app
  3. ionic browser add crosswalk

I see the following after that:

Adding crosswalk browser
Downloaded cordova-crosswalk-engine
Downloaded Cordova Android for Crosswalk
Downloading: https://download.01.org/crosswalk/releases/crosswalk/android/stable/8.37.189.14/arm/crosswalk-webview-8.37.189.14-arm.zip
Downloading: https://download.01.org/crosswalk/releases/crosswalk/android/stable/8.37.189.14/x86/crosswalk-webview-8.37.189.14-x86.zip
[=============================] 100% 0.0s
[=============================] 100% 0.0s
Downloaded Crosswalk webviews
Fetching Android SDK API 19.1.0
Downloaded Android runtime (API 19)
Removed old Cordova Android platform
Added Cordova Android 4.0
Added Crosswalk Webview Engine
Ionic Browser Add completed for Crosswalk

  1. After this when I do ionic run android, I see:
    No platforms added to this project. Please use cordova platform add <platform>.

Am I expected to manually add the android platform?

Most helpful comment

I found the solutions
" cordova platform add android --save "
We need to manually add android platform in ionic project !!!!
Then "ionic run android"

All 27 comments

Also, if I do go ahead and add android platform, I am not sure that crosswalk is getting packaged when I run the app (I verified this because the size of the output apk is the same as without crosswalk).

@arunr - the ionic browser add crosswalk should take care of everything for you. You should not have to manually add the android version.

I think what is happening here is an error perhaps and not reporting it?

First, go ahead and run ionic info and copy/paste that info here so I can see what your runtime is.

Second, if you list the contents after the command has finished, is there nothing inside the platforms/android folder?

Hi,

I am also getting this type of error with below message.

FAILURE: Build failed with an exception.

  • Where:
    Script '/Users/mahabahubehera/kross/platforms/android/cordova.gradle' line: 52
  • What went wrong:
    A problem occurred evaluating script.

No usable Android build tools found. Highest installed version is 19.0.3; minimum version required is 19.1.0.

  • 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.335 secs

/Users/mahabahubehera/kross/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error code 1 for command: /Users/mahabahubehera/kross/platforms/android/gradlew with args: assembleDebug,-b,/Users/mahabahubehera/kross/platforms/android/build.gradle,-Dorg.gradle.daemon=true
Error: /Users/mahabahubehera/kross/platforms/android/cordova/run: Command failed with exit code 8
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:135:23)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:756:16)
at Process.ChildProcess._handle.onexit (child_process.js:823:5)

@mahabahu - please run android in your command line, locate and install the `Android SDK Build-tools 19.1.0

Hopefully that will fix the issue.

@jbavari - While installing the SDK 19.1 i am getting following error
Downloading Android SDK Build-tools, revision 19.1
Failed to create directory /usr/local/Cellar/android-sdk/22.6.2/temp

Are you installing the android tools with brew?

@mahabahu - after doing a little research, it looks like your issue is more with the sdk not updating due to some permission or other file related errors.

I'd start researching on how to update the sdk without the errors you're having, as well trying sudo android to see if that helps by running it with higher permissions.

if you are running on windows try to turn off UAC, It helped me now.

@jbavari thanks for your help! When I run ionic info, I see this:

OS: Mac OS X Yosemite
Node Version: v0.10.28
Cordova CLI: 3.5.0-0.2.4
Ionic Version: 1.0.0-beta.11
Ionic CLI Version: 1.3.1
Xcode version: Xcode 6.1.1 Build version 6A2008a
ios-sim version: 1.9.0

Also, after running ionic browser add crosswalk, my platforms/ directory is empty - no android inside that directory.

@jbavari: I have tried with sudo android but with no success. Though i have already installed android studio and it has a sdk manager with updated build tool 22.1.0. But while running the android command it opens another instance of SDK manager in a different path as i mentioned above.

Im having this problem too. ionic browser add [email protected] runs successfully, but then ionic run android yields this error:

The provided path "/Users/collin/Projects/ionicapp/platforms/android" is not an Android project.
$ ionic info

Your system information:

OS: Mac OS X Yosemite
Node Version: v0.10.35
Cordova CLI: 3.5.0-0.2.4
Ionic Version: 1.0.0-beta.14
Ionic CLI Version: 1.3.2
Xcode version: Xcode 6.1.1 Build version 6A2008a 
ios-sim version: 3.1.1 

I think I got it working! I'm not sure what fixed it - I think the main thing was reloading my terminal. But I also updated npm to the latest version. The first thing that started working -- after ionic browser add crosswalk and then failing to run ionic run android -- running ionic platform android started giving me an error that the engine.crosswalk plugin required cordova-android version >= 4.0.0-dev. Once I upgraded cordova to the latest (v4.2) (npm update -g cordova), ionic run android seems to be building an app!

@colllin this worked for me too... thanks so much! (* upgrade cordova, and re-launch my terminal). Now I need to figure out how to get the plugins working!

I'm not sure this should be closed yet... At the very least it should detect the issue and print out instructions for how to fix it. Better if it can just fix the problem for you.

@colllin, agree, re-opening it.

Hi collin (@collin),
I followed all the suggestions you made above but I still get the error below when I run $ ionic run android

Running command: /Users/drsedusa/Desktop/temp/my_app/hooks/after_prepare/010_add_platform_class.js /Users/drsedusa/Desktop/temp/my_app
add to body class: platform-android
Running command: /Users/drsedusa/Desktop/temp/my_app/platforms/android/cordova/run 
WARNING : No target specified, deploying to emulator
WARNING : no emulator specified, defaulting to AVD_for_s4

I can't seem to figure out why I get the WARNING: No target specified error message even though my platforms/android folder seems complete.

screen shot 2015-01-20 at 11 53 54 am

Below is a copy of my system info.

$ ionic info

Your system information:

OS: Mac OS X Yosemite
Node Version: v0.10.30
Cordova CLI: 4.2.0
Ionic CLI Version: 1.3.2
Xcode version: Xcode 6.1.1 Build version 6A2008a 
ios-sim version: 3.0.0 

I'd really appreciate the help figuring out what's going on. Thanks!!

Looks like you don't have a device connected via usb, and also don't have
an emulator installed? so ionic run android has nothing to run on? Try
just ionic build android, or try connecting your device?

On Tuesday, January 20, 2015, sedusa [email protected] wrote:

Hi collin (@collin https://github.com/collin),
I followed all the suggestions you made above but I still get the _error_
below when I run $ ionic run android

Running command: /Users/drsedusa/Desktop/temp/my_app/hooks/after_prepare/010_add_platform_class.js /Users/drsedusa/Desktop/temp/my_app
add to body class: platform-android
Running command: /Users/drsedusa/Desktop/temp/my_app/platforms/android/cordova/run
WARNING : No target specified, deploying to emulator
WARNING : no emulator specified, defaulting to AVD_for_s4

I can't seem to figure out why I get the WARNING: No target specified
error message even though my _platforms/android_ folder seems complete.

[image: screen shot 2015-01-20 at 11 53 54 am]
https://cloud.githubusercontent.com/assets/5447546/5821571/1ffd6556-a09b-11e4-9cf1-9c31c4893d29.png

Below is a copy of my system info.

$ ionic info

Your system information:

OS: Mac OS X Yosemite
Node Version: v0.10.30
Cordova CLI: 4.2.0
Ionic CLI Version: 1.3.2
Xcode version: Xcode 6.1.1 Build version 6A2008a
ios-sim version: 3.0.0

I'd really appreciate the help figuring out what's going on. Thanks!!

—
Reply to this email directly or view it on GitHub
https://github.com/driftyco/ionic-cli/issues/179#issuecomment-70690197.

@colllin thanks a lot. @jbavari helped clear up the confusion I was having about the workings of Crosswalk yesterday (issue #197). Everything's working fine now.

@colllin - Just seeking some concept clarification here, do you recommend we post a message asking the user to upgrade cordova (npm install -g cordova) or just run this command for them?

@jbavari I can't be certain that was the issue. I don't want to waste
anyone's time, so if we don't know what the issue was, I guess there is no
issue. But we both definitely had trouble following the instructions in
the blog post. Might be the case that all that was needed was reloading the
terminal? Can you detect the error and send them to this issue to provide
more information / a list of things to try? This was supposed to be a
magical function of the cli (using crosswalk), but in fact took up 2 nights
of frustrated debugging in circles.

On Wednesday, January 21, 2015, Josh Bavari [email protected]
wrote:

@colllin https://github.com/colllin - Just seeking some concept
clarification here, do you recommend we post a message asking the user to
upgrade cordova (npm install -g cordova) or just run this command for
them?

—
Reply to this email directly or view it on GitHub
https://github.com/driftyco/ionic-cli/issues/179#issuecomment-70917101.

@colllin - I see. I'm sorry for your troubles! Most people it worked great for. There is such a huge breadth of users and their runtime environments, it's hard to make this _perfect_ for everyone. I was sure trying my hardest, sorry to give you such a run around.

I might need to revamp the blog post with a npm install -g cordova to ensure their cordova version is up to date. I definitely overlooked this :(

Alternatively, I'm going to look at detecting the version and showing the user a message to update their cordova version to 4.0+.

For now, I'm trying to recreate it by installing cordova 3.5 and seeing if I can get this working to help others.

Again, I apologize, and I hope I can work harder to keep you happy. Thank you for the feedback, truly, it is appreciated.

@colllin - to ensure your request is fulfilled, I've got issue #200 that should help the users of the CLI keep their environments up to date.

Thank you @jbavari, I appreciate your sincere effort.

On Wednesday, January 21, 2015, Josh Bavari [email protected]
wrote:

@colllin https://github.com/colllin - to ensure your request is
fulfilled, I've got issue #200
https://github.com/driftyco/ionic-cli/issues/200 that should help the
users of the CLI keep their environments up to date.

—
Reply to this email directly or view it on GitHub
https://github.com/driftyco/ionic-cli/issues/179#issuecomment-70944191.

This is out in latest, 1.3.11, now gives users directions on how to update their 'out of date' dependencies.

Awesome! Thank you for taking care of that. Have a great weekend!

On Friday, February 20, 2015, Josh Bavari [email protected] wrote:

This is out in latest, 1.3.11, now gives users directions on how to update
their 'out of date' dependencies.

—
Reply to this email directly or view it on GitHub
https://github.com/driftyco/ionic-cli/issues/179#issuecomment-75324347.

I found the solutions
" cordova platform add android --save "
We need to manually add android platform in ionic project !!!!
Then "ionic run android"

@shanmugasundharamselvadurai Good find, you can also do this with ionic command instead of cordova.

Was this page helpful?
0 / 5 - 0 ratings