11

I'm trying to create a mobile application which combine the above projects and I'm not sure how should I do it.

Here are 2 options which I found:

  1. Use https://github.com/MobileChromeApps/mobile-chrome-apps - My problem with it is that it seems that it's not production ready. (I was told that it is but I can't find any support for that).
  2. Create a new ionic project, then add Cordova to it followed by empting the platforms/android/CordovaLib/ folder and moving into it files from Crosswalk (as explained at https://www.thepolyglotdeveloper.com/2014/10/use-crosswalk-ionic-framework-android-apps/) - This solution is quite simple but seems a little hackish for me...

Which option should I use? are there any other options?

Cheers,

---- Update ----

Ionic have incorporated the ability to combine Crosswalk in their own CLI, check it out at http://ionicframework.com/blog/crosswalk-comes-to-ionic/

Nic Raboy
  • 3,143
  • 24
  • 26
  • Maybe it depends if you care about all the extra google services in the Mobile Chrome Apps? And in the link you provide, the third line says "developer preview", so I guess it's really not supposed to be production ready... – QuickFix Nov 07 '14 at 15:02
  • 1
    By the way, thanks for your second link, I had no idea that cordova-crosswalk was only working for cordova-android 3.5 (I was fighting with https://crosswalk-project.org/documentation/cordova/migrate_an_application.html) – QuickFix Nov 07 '14 at 15:05
  • And last note, you should use 3.5.1 instead of 3.5 (https://crosswalk-project.org/blog/crosswalk-cordova-update-351.html) – QuickFix Nov 07 '14 at 15:13

3 Answers3

13

Regarding Crosswalk

Crosswalk support is something that we hope will be available to vanilla cordova by default before the end of the year. You can start experimenting with this today by following the work on the cordova-android 4.0 development branch. It should be possible to add this platform (and the required plugins) directly to a new ionic project.

Chrome Apps for Mobile are cordova-cli compatible and do indeed already bundle Crosswalk by default. The primary difference with vanilla cordova is that applications must follow the Chrome Packaged App structure (have a manifest and background script), but gain the benefit of running on Desktop Chrome. See longer answer here. (I wouldn't read too much into the developer preview label.. we just like calling everything beta ;)

The current crosswalk-project.org provided cordova workflow does not use a cordova multi-platform application structure. It uses the cordova-android native app template directly. This means you will not be able to use the cordova cli, nor downstreams like cca or ionic. You will also obviously not be able to add other platforms, will have a tougher time upgrading, and managing plugins is a bit more complicated (you have to use the plugman tool directly).

There is currently no option for developing using cordova+crosswalk that is not without some tradeoff.

Regarding compatibility between Cordova, Ionic, Chrome Apps for Mobile (etc) projects

Most cordova downstream projects are "mostly" cli compatible. E.g. The cca cli (used by Chrome Apps for Mobile) supports commands like create, plugin add and platform add -- so it will work to install ionic plugins. Vice versa is also true, Chrome Api's for Mobile are developed as cordova plugins which can be added to an Ionic or cordova project using their respective cli's.

Most downstreams also use the same project directory structure (plugins/, platforms/, www/, hooks/, etc), so you can usually mix usage of the various cli's within one project to some degree.

That said, the reason cca needed a custom cli is because we do a few non standard modifications to your cordova project that aren't directly supported by vanilla cordova (yet). Ionic does the same.

I've suggested at various cordova meetups that downstream projects like Ionic, PhoneGap, and CCA, should play better together -- so your question is right on the money. We are mostly-compatible but finding out the differences is currently left as an exercise to the developer.

Community
  • 1
  • 1
mmocny
  • 8,775
  • 7
  • 40
  • 50
  • Great answer thx a lot! I will digest it in the next hours/days or so and will probably come back with few others if u don't mind :D btw its funny, b4 asking my question I saw ur answers about Chrome App for Mobile and wanted to contact u, and now u asked me about the usb (didn't connect it to u... pictures r better then nicks I guess), the moral of the story, its helpful to be helpful ;) – Nimrod Yonatan Ben-Nes Nov 13 '14 at 09:50
  • 1
    OK so I set cca project up with Ionic in its www folder (kept cca manifest & background.js files), when I try to run it its loading up but I get Uncaught TypeError: Cannot read property 'Keyboard' of undefined (app.js:14), what happens is that window.cordova.plugins is undefined (window.cordova is defined). I already commented out cordova.js – Nimrod Yonatan Ben-Nes Nov 15 '14 at 16:11
  • oh and one last question just to be sure, cca is working for Android 4.X and also iOS6+ (inc. iOS8) right? – Nimrod Yonatan Ben-Nes Nov 15 '14 at 16:16
  • I created a new question about this problem which detail it a lot better http://stackoverflow.com/questions/26949456/running-ionic-at-cca-throw-cannot-read-property-keyboard-of-undefined-app if u can take a quick look it will be awesome – Nimrod Yonatan Ben-Nes Nov 15 '14 at 18:54
5

Using XDK HTML5 Cross platform Development IDE is probably the best way of integrating Crosswalk, Cordova and Ionic. It has built in support for Crosswalk. I have recently used it and its totally awesome. It will make our work a lot easier.

From Crosswalk site:

If you prefer to use a graphical integrated development environment (IDE), the free Intel XDK provides an alternative way to package applications for Crosswalk Android. See the Intel XDK website for more details.

Bipin Bhandari
  • 2,694
  • 23
  • 38
  • Well at the end I decided actually to d/l the Crosswalk package which combine Cordova with it, and the replace its assets/www/ content with the www folder content of an ionic project (which I built according to the Ionic manual). I even made it all with a nice Docker :) I mark ur question has correct since indeed that seems to be the most straightforward way to go (I wanted to avoid installation of software at my "environment") – Nimrod Yonatan Ben-Nes Nov 09 '14 at 15:04
  • @NimrodYonatanBen-Nes Curious if you managed to use USB through your docker image, or just exported the final apps to another machine? – mmocny Nov 11 '14 at 15:06
  • @mmocny yup the usb is connected directly to the docker, will post later the way to do it (I'm not at my dev station now...) – Nimrod Yonatan Ben-Nes Nov 11 '14 at 16:39
  • @NimrodYonatanBen-Nes I would really appreciate that, especially if you have an answer for OSX/Windows. I saw some clever ways to get this to work on linux only. – mmocny Nov 11 '14 at 21:10
  • @mmocny oh bummer, I use linux... just in case it may help u what I do is add to docker run: --privileged -v /dev/bus/usb:/dev/bus/usb More info can be found at http://docs.docker.com/reference/run/#runtime-privilege-linux-capabilities-and-lxc-configuration as u can c even from the url its 4 linux... – Nimrod Yonatan Ben-Nes Nov 11 '14 at 21:21
  • @NimrodYonatanBen-Nes Alrighty, that's what I suspected. Been trying to get this working for while, but doesn't seem trivial. Thanks for getting back to me! – mmocny Nov 11 '14 at 22:15
5

This guy on youtube produced a nice, straight-forward tutorial that worked for me: https://www.youtube.com/watch?v=0I1OjJLVLMo

The results are fantastic, worth the struggle to get it working.

The guy says CrossWalk makes a big difference on anything running less than Android 4.4 (when Chromium was added).

Good luck.

JoshuaDavid
  • 8,861
  • 8
  • 47
  • 55
  • Actually the second link I wrote is to an article by the same guy who made that video, will check it nontheless when I'll try again to embed crosswalk (or use cca since I encountered problems there as well). thx! – Nimrod Yonatan Ben-Nes Dec 14 '14 at 09:43