Alon Amir
Alon Amir

Reputation: 5015

Run Polymer Dart from Cordova using pub serve

I'm trying to run a polymer dart app from Cordova via pub serve.

Here's what I tried:

  1. Used the generated polymer project from stagehand, latest web storm (11.0.3), latest dart dev build (1.14.0-dev.5.0).
  2. Disabled app transport security (for iOS, plist entry, there's a cordova plugin for that).
  3. config.xml: I set both access origin, and allow navigation to *.
  4. Set <content src="http://localhost:8080/index.html" /> instead of <content src="index.html" /> (also tried to put the LAN IP instead of localhost).
  5. csp: true in $dart2js and web_components transformers.
  6. Used Content-Security-Policy meta tag to allow pretty much everything.
  7. Ran pub serve --hostname 0.0.0.0.
  8. cordova run ios -> then I get a white blank app.

Upvotes: 2

Views: 202

Answers (3)

Alon Amir
Alon Amir

Reputation: 5015

The "fix" was to use a later version of Cordova.

Had this issue with 5.1.1, when I updated to the latest (5.4.1 at the moment of writing), it works fine, didn't even need to re-create the Cordova project folder.

I went back and forth between these 2 versions to verify that this was the problem.

Upvotes: 1

David Notik
David Notik

Reputation: 2086

I've had success wrapping my Polymer.dart app with Cordova.

Did you verify that your App Transport Security Settings are correct and that Allow Arbitrary Loads is YES? You say you used a plugin for that, but perhaps it wasn't set appropriately.

Did you enable CORS in your Dart server, so that your Cordova app can make requests of it?

Did you drop the output of pub build (in /build) into the platforms/ios//www folder of your Cordova project?

Upvotes: 0

bwnyasse
bwnyasse

Reputation: 629

Which version of web_components are you using in your pubspec.yaml ?

According to this issue and this stack , maybe you may need to override the web_components version like this:

dependency_overrides: web_components: "^0.12.0+3"

Upvotes: 0

Related Questions