pfried
pfried

Reputation: 5079

Polymer on Cordova

Has anyone a running cordova app with polymer?

I am using angular.js with polymer on cordova, in my Chrome (v37) everything is fine, in the Android debug console i get an error and the screen stays white:

07-03 16:53:26.865: D/CordovaLog(11728): file:///android_asset/www/js/index.js: Line 9899 : Error: Assertion failed
07-03 16:53:26.865: D/CordovaLog(11728):     at c (file:///android_asset/www/polymer/platform/platform.js:12:21781)
07-03 16:53:26.865: D/CordovaLog(11728):     at b (file:///android_asset/www/polymer/platform/platform.js:13:8230)
07-03 16:53:26.865: D/CordovaLog(11728):     at b.F.insertBefore (file:///android_asset/www/polymer/platform/platform.js:13:11769)
07-03 16:53:26.865: D/CordovaLog(11728):     at b.F.appendChild (file:///android_asset/www/polymer/platform/platform.js:13:11720)
07-03 16:53:26.865: D/CordovaLog(11728):     at replaceWith (file:///android_asset/www/js/index.js:6983:16)
07-03 16:53:26.865: D/CordovaLog(11728):     at applyDirectivesToNode (file:///android_asset/www/js/index.js:6282:13)
07-03 16:53:26.865: D/CordovaLog(11728):     at compileNodes (file:///android_asset/www/js/index.js:5958:15)
07-03 16:53:26.865: D/CordovaLog(11728):     at compileNodes (file:///android_asset/www/js/index.js:5970:15)
07-03 16:53:26.865: D/CordovaLog(11728):     at compileNodes (file:///android_asset/www/js/index.js:5970:15)
07-03 16:53:26.865: D/CordovaLog(11728):     at compileNodes (file:///android_asset/www/js/index.js:5970:15)

Polymer is on version 0.3.3 and cordova is 3.5.0-0.2.4, Android is 4.4.4

The app doesnt start and i removed all the html for testing, but the error stays the same

Upvotes: 2

Views: 3888

Answers (5)

Pieter Spoelstra
Pieter Spoelstra

Reputation: 1

I've had also a lot of problems making Polymer 1.0 work. For me the solution was to solve CORS (Cross scripting), App security related problems. The trick was to add the following in the config.xml.

<gap:plugin name="cordova-plugin-whitelist" source="npm" version="1.2.1" />

With the options

<allow-navigation href="http://*/*" />
<allow-navigation href="https://*/*" />
<allow-navigation href="data:*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<access origin="*" />

It's not secure to use them in this way (you allow everything, to everybody). But it gave me access to Polyfill and other Stuff, using external CDN servers. Which were at first blocking me, showing a white screen.

Upvotes: 0

Nic Raboy
Nic Raboy

Reputation: 3153

I got it working with Android 4.4. I've heard rumors you can use Crosswalk to get it working with earlier versions of Android.

I made a tutorial of my Polymer Cordova project here:

https://www.thepolyglotdeveloper.com/2014/07/use-polymer-apache-cordova/

Upvotes: 5

Aleksandar Totic
Aleksandar Totic

Reputation: 2597

I am using Polymer with Cordova on iPhone 6, and it works really well.

Cordova on iPhone 6

Upvotes: 1

Hugo Matilla
Hugo Matilla

Reputation: 1304

Nics tutorial is really good. Thanks Nic.

Moreover I recommend to check Chrome Dev Editor, it has already built in everything to play and run.

MobileChromeApps https://github.com/MobileChromeApps/mobile-chrome-apps

ChromeDevEditor https://github.com/dart-lang/chromedeveditor

Hope it helps.

Upvotes: 2

Garrows
Garrows

Reputation: 3031

It works fine for me on 4.4.4 but I needed to support earlier versions so I used MobileChromeApps which uses Cordova and crosswalk to deploy your app with chrome instead of using the default browser that isnt supported by polymer.

This worked fine for me but on iOS it's not using chrome and is using the default webView which is safari which doesn't seem to work with MobileChromeApps but does work with plain old Cordova. Uuugh.

Anyone got cross walk working for iOS with MobileChromeApps?

Upvotes: 0

Related Questions