cordova net::ERR_CACHE_MISS

cordova

Solution

This Error means you don't have access to internet.There are two ways you can provide this access by changing these files

1.AndroidManifest.xml

add these following permission

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.NETWORK_ACCESS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

2. config.xml

For this you are going to need this plugin

cordova plugin add cordova-custom-config

after adding this plugin , add these lines in you config.xml

<platform name="android">
   <config-file target="AndroidManifest.xml" parent="/*">
      <uses-permission android:name="android.permission.INTERNET" />
      <uses-permission android:name="android.permissions.NETWORK_ACCESS" />
      <uses-permission android:name="android.permissions.ACCESS_NETWORK_STATE" />
   </config-file>
</platform>

You can try it . Hope it helps you .Thanks

Problem

i have an cordova pp i am calling a post method in controller it works in browser , but in build and debug apk i get the error ionic.bundle.js:23826 POST http://somedomain.com/api/account/validation net::ERR_CACHE_MISS my angular controller ``` .controller('splashCtrl', function ($scope, $state,$http, userManager, serverConfig) { //check if the user exist else it will redirect to login $scope.authenticate = function () { $http.post(serverConfig.serverUrl + '/api/account/validation').success(function (res,status) { if (status == '200') { //check if the user need to change password if (window.localStorage.getItem('shouldChangePassword') && window.localStorage.getItem('shouldChangePassword')=='true') { $state.go('setPassword'); return; } $state.go('tab.category'); } }).error(function (data, status) { console.log(status) }) } $scope.authenticate(); }) ``` any suggestion ?

Original source