cordova net::ERR_CACHE_MISS

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 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 ?

1

3 Answers

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

5

If you encounter this problem after removing a plugin or installing a plugin then this solution might work for you.

cordova platform remove android
cordova platform add android

There is no harm in trying it even if you've not installed or removed any plugin.

1

Note that if you have recently uninstalled a plugin and it started happening, then the solution by David Addoteye to remove and add the platform back may do it, worked for me.

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like