Ionic Network Error

http://abou-kone.com/2015/04/25/ionic-there-was-a-network-error-when-running-on-genymotion/

Running Ionic with Genymotion, you might run into network issues when trying to run your application in your Genymotion device VM. The one I got was :

1
2
Application Error
There was a network error (http://192.168.56.1)

when trying to launch my app on the device. It wasn’t a firewall issue, i was successfuly able to ping my host machine from Chrome within the device. Ran some debugging from within Android Studio and saw that:

1
04-25 16:10:45.960  14405-14433/com.exam.examinous W/SystemWebViewClient﹕ URL blocked by whitelist: http://192.168.56.1:2019/

It turns out that with Cordova 5 and Ionic 1.3 you :

1
2
3
4
─$ cordova -v
5.0.0
─$ ionic -v
1.3.20

You need to add the Cordova Whitelist Plugin

1
ionic plugin add https://github.com/apache/cordova-plugin-whitelist.git

and rebuild, that should set you.

Also if you’re running into this error when trying to add a plugin:

1
2
3
4
SyntaxError: Unexpected token }
at Object.parse (native)
at getJson (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/util/metadata.js:29:31)
at Object.exports.save_fetch_metadata (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/util/metadata.js:56:24)

then check your plugins/fetch.json file for extra brackets.

A %d blogueros les gusta esto: