Hello guys,
I have a simple app that make some requests to a back-end api.
It works like a charm on the browser and IOS simulator, but it fails on Android.
The request does not touch my server. The error occurs inside the createHttpBackend function on $http lib. The error line is selected bellow:
I think it is a particular config that I am missing for the Android platform because it works in browser/IOS.
Perhaps like me you just learned the hard way that Android emulators run on their own IP, not localhost. So if you are trying to connect to http on “localhost” it will fail. I changed it to our public stage server and it worked like a champ.
i am not sure but i remember i got a problem exactly with that line. What worked if i can remember was to delete the plugins and the platforms directory, then add the android platform again and plugins.
Aside from localhost needing to be an actual IP, you’ll have to add cordova-plugin-whitelist in the newer versions of things to make the HTTP request work on android