问题
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'
回答1:
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!
回答2:
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.
来源:https://stackoverflow.com/questions/29437035/whitelist-not-working-ionic-with-crosswalk