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:
Which option should I use? are there any other options?
Cheers,
Ionic have incorporated the ability to combine Crosswalk in their own CLI, check it out at http://ionicframework.com/blog/crosswalk-comes-to-ionic/
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.
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.