10

I created a working app using ionic. there was no problem with fetching data from my site and everything was good.

I then went to add crosswalk to it and now i get the error when i run it on my android phone:

W/XWalkCordovaResourceClient():URL blocked by whitelist: http://example.com/api/

In the top level config.xml i have tried each of the following (not all 3 at once) and reran it (ionic run android) with the same results:

  <access origin="*"/>
  <access origin="http://www.example.com/*"/>
  <access origin="http://www.example.com"/>

What am I doing wrong?

running 'ionic info' i get:

OS: Max OS Yosemite
Nodoe Version: v0.10.36
Cordova CLI: 4.3.0
Ionic CLI Version: 1.3.19
Xcode version: Xcode 6.2 Build Version 6C121e
ios-sim version: 3.1.1.

As a separate but possible related question, after installing crosswalk running the app on an android emulator has stopped working also - after building successfully it just says 'the app has stopped'

user1139675
  • 434
  • 6
  • 17

2 Answers2

27

I figured it out! The problem is that in the latest Cordova, they've split out the whitelist functionality into its own plugin.

Simply run ionic plugin add https://github.com/apache/cordova-plugin-whitelist.git and you're good!

TheBosZ
  • 657
  • 5
  • 10
  • thanks. I added that but can't figure out what the CSP should be for it to work. right now i have: `script-src 'self 'unsafe-eval' 'unsafe-inline'; object-src 'self' http://www.example.com` and i still get those URL blocked by whitelist messages – user1139675 Apr 09 '15 at 19:55
  • 1
    You don't have to have CSP for it to work. Just remove the line and it'll complain in the logs but everything should work. – TheBosZ Apr 11 '15 at 00:58
  • thanks! in the end i had to upgrade from cordova-android 3.7 to 4.0, then install the plugin and ignore the warning. – user1139675 Apr 13 '15 at 18:18
0

I had problems getting tiles from openstreetmaps and google maps api and i solved it by followed the answer from this thread http://forum.ionicframework.com/t/crosswalk-whitelist/20329.

Basically the workaround is to go to ""\platforms\android\src\org\crosswalk\engine\XWalkCordovaResourceClient.java" line 204, comment the return out and rebuild the app.

Its not a smooth solution but it solves my problem for now.

In regards to your other question the steps i would suggest is to first : Emulate using Genymotion. If that doesnt work i would try to remove and re-add Android.

Hope it helps.

user3713062
  • 1
  • 1
  • 3