Polymer and cca/cordova

1,302 views
Skip to first unread message

Aleksandar Rodic

unread,
May 30, 2014, 4:08:50 PM5/30/14
to polym...@googlegroups.com
I recently tried to build a native Cordova app with cca and it appears that polymer doesn't work inside the WebView. Just including polymer+platform returns errors.

My understanding is that the WebView uses Chrome that is several versions behind the stable release. Perhaps it is much further behind than I thought :)

There are rumors that the next version of WebView might get WebGL support (that was Chrome 30 on mobile I think)

What is the oldest version of Chrome that polymer can run on? It would be extremely useful if with the next WebView, we can wrap polymer apps and put them on Play Store.

Aki
--

Aleksandar Rodic | Creative Technologist |  Google Creative Lab | aleksa...@google.com

Matthew McNulty

unread,
May 30, 2014, 4:26:33 PM5/30/14
to Aleksandar Rodic, polym...@googlegroups.com
Polymer 0.3.1 should address this issue. There was a bug in the shadow DOM polyfill. 


Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups "Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to polymer-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/polymer-dev/CACWkRh8MBg6P40okmj1%3D-N-eH4%2BCj6XLZXRqCAHU%3Db3OzVk7aA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Aleksandar Rodic

unread,
May 30, 2014, 7:06:43 PM5/30/14
to Matthew McNulty, polym...@googlegroups.com
I tried with polymer 0.3.1 still getting errors (see below). However, it turns out, it works fine without cca/cordova. I managed to get it running inside the WebView using Android Studio.

My guess this happens because cordova injects a bunch of scripts and polyfils before the platform.js.

platform.js is not the first script on the page. See http://www.polymer-project.org/docs/start/platform.html#setup for details. boot.js:49
'window.webkitStorageInfo' is deprecated. Please use 'navigator.webkitTemporaryStorage' or 'navigator.webkitPersistentStorage' instead.
Uncaught NotFoundError: An attempt was made to reference a Node in a context where it does not exist. HTMLUnknownElement.js:28
Uncaught TypeError: Object #<Object> has no method 'deliverDeclarations' polymer-expressions.js:222

Michal Mocny

unread,
Jun 2, 2014, 10:47:08 AM6/2/14
to Aleksandar Rodic, Matthew McNulty, polym...@googlegroups.com
Thanks for trying out cca!

Polymer certainly used to work with cca (we fixed bugs to make sure it did), and we've been using it recently so this must be a regression / environment issue.  I haven't tried it on vanilla cordova.

Regarding WebView and chromium versions, there's a very exciting project in the pipeline (read on!), but here are the full details:

(0): WebView on Android 4.3 or lower is not based on chrome at all.
(1): KitKat WebView up to 4.4.2 is based on Chrome 30, but some features are turned off (like WebGL, WebRTC).
(2): KitKat WebView 4.4.3 seems based on Chrome 33.  As far as I know this is still an internal dogfood that has not shipped yet.
(3): Android L-Release is intended to ship with an auto-updating Chrome WebView, which I assume with update alongside the browser update schedule.
(4): We (cordova team) are playing with bundling a build of chromium alongside your application, leveraging a project called crosswalk.  This means you get build your app with your own webview based on Chrome 35+, with WebGL, WebRTC, etc, and will run on devices all the way back to ICS (4.0) of Android!  It does means an extra ~18Mb to your binary and fewer opportunities to share memory with other apps, but for devs it means you don't have to deal with legacy webview or different webview implementations on various client machines.  Until L-release auto-update WebView, this will likely be a huge hit with hybrid app developers.


If you would like to try using cca with crosswalk (Chrome 35 based, 36 soon), follow these quick steps:
> cd mobile-chrome-apps
> git checkout crosswalk
> git submodule update --init
> npm install
> npm link
> cd ..

Now you should have a global install of `cca` that will automatically use crosswalk.  Now create a project and try it out as usual:

# You must have Android SDK set up already -- if you've ever created a cca/cordova android project before, you should be alright.
> cca create HelloWorld
> cd HelloWorld
> cca run android

For full instructions on building cca based chrome apps for mobile apps, read: https://github.com/MobileChromeApps/mobile-chrome-apps/blob/master/README.md

I encourage everyone to try this, since we (cordova team) intend to promote development of polymer based hybrid apps using crosswalk a lot this year.

Good Luck, Have fun!

-Michal


monol...@gmail.com

unread,
Jun 25, 2014, 5:53:04 PM6/25/14
to polym...@googlegroups.com, aleksa...@google.com, mmcn...@google.com
This is very exciting. Could 'Phonegap Build' eventually include the option to bundle the webview in your app?

bischo...@gmail.com

unread,
Aug 12, 2014, 7:37:37 AM8/12/14
to polym...@googlegroups.com, aleksa...@google.com, mmcn...@google.com
Hi Michal

Is there real the need to use Chrome Mobile Apps?
Since you use Crosswalk, you already have the access to Chromium which is the point, isn't it?

Couldn't I just run my Polymer within Crosswalk which runs in a Cordova app?
Equals:
Cordova -> Crosswalk -> Polymer/HTML/CSS

Maybe I've just got it completly wrong, but aren't Crosswalk and CMA about the same?
Crodova -> Crosswalk < - ? - > Chrome Mobile Apps -> Polymer/HTML/CSS

Lukas
Reply all
Reply to author
Forward
0 new messages