I had an issue that my app can't connect to my own api at the actual or emulator android device. Anyway, my issue is resolved by following change to root
// change from this <access origin="*" /> // to following code <access origin="http://*" /> <access origin="https://*" />
Now, each dev's enviromen might be different, you might encouter the same issue by fixed by different things. At the point I was fixing my issue, my phonegap is using
6.4.2, npm is
3.10.3, node version is
v6.7.0, Android studio is using
2.2.2, windows OS version is
> node -v > npm -v > ver > phonegap version
Some people also said they had same issue but because of missing
cordova-plugin-whitelist plugin, but my phonegap
is already contains that plugin, but if you don't have it, you can try to add it to see if fix your issue or not.
<plugin name="cordova-plugin-whitelist" source="npm" spec="~1.2.1" />
I also, my issue was html's content-security-policy issue, so I defined my api over there, so make sure all my api are able to call but at the end, still failed at the android device, and after I add my temporary access origin at the root
config.xml, even I removed my content-security-policy tag, still works.
<meta http-equiv="Content-Security-Policy" content="default-src 'self' .....
So, could be phonegap change something away to handler these...