Error in apk in ionic 3

hey Im new to ionic . i have an error in ionic 3… apk is not working on device and no api getting hit on devic but on desktop its working properly im not getting why this issue is coming… not one app but on every app its working same…im not getting how to slove it…
thank you in advanced… plz someone help me out…

package.json
{
“name”: “wolters”,
“version”: “0.0.1”,
“author”: “Ionic Framework”,
“homepage”: “http://ionicframework.com/”,
“private”: true,
“scripts”: {
“clean”: “ionic-app-scripts clean”,
“build”: “ionic-app-scripts build”,
“lint”: “ionic-app-scripts lint”,
“ionic:build”: “ionic-app-scripts build”,
“ionic:serve”: “ionic-app-scripts serve”
},
“dependencies”: {
@angular/common”: “^5.0.3”,
@angular/compiler”: “^5.0.3”,
@angular/compiler-cli”: “^5.0.3”,
@angular/core”: “^5.0.3”,
@angular/forms”: “^5.0.3”,
@angular/http”: “^5.0.3”,
@angular/platform-browser”: “^5.0.3”,
@angular/platform-browser-dynamic”: “^5.0.3”,
@ionic-native/core”: “^4.4.0”,
@ionic-native/file”: “^4.7.0”,
@ionic-native/file-opener”: “^4.7.0”,
@ionic-native/file-transfer”: “^4.7.0”,
@ionic-native/splash-screen”: “^4.4.0”,
@ionic-native/status-bar”: “^4.4.0”,
@ionic-native/video-player”: “^4.7.0”,
@ionic/pro”: “^1.0.19”,
@ionic/storage”: “^2.1.3”,
“cordova-android”: “6.3.0”,
“cordova-android-support-gradle-release”: “^1.3.0”,
“cordova-plugin-device”: “^2.0.1”,
“cordova-plugin-file”: “^6.0.1”,
“cordova-plugin-file-opener2”: “^2.0.19”,
“cordova-plugin-file-transfer”: “^1.7.1”,
“cordova-plugin-ionic-keyboard”: “^2.0.5”,
“cordova-plugin-ionic-webview”: “^1.2.0”,
“cordova-plugin-splashscreen”: “^5.0.2”,
“cordova-plugin-video-player”: “^1.0.1”,
“cordova-plugin-whitelist”: “^1.3.3”,
“ionic-angular”: “^3.9.2”,
“ionicons”: “^3.0.0”,
“rxjs”: “^5.5.2”,
“sw-toolbox”: “^3.6.0”,
“zone.js”: “^0.8.18”
},
“devDependencies”: {
@ionic/app-scripts”: “3.1.8”,
“typescript”: “2.4.2”
},
“description”: “An Ionic project”,
“cordova”: {
“plugins”: {
“cordova-plugin-whitelist”: {},
“cordova-plugin-device”: {},
“cordova-plugin-splashscreen”: {},
“cordova-plugin-ionic-webview”: {},
“cordova-plugin-ionic-keyboard”: {},
“cordova-plugin-file-transfer”: {},
“cordova-plugin-file-opener2”: {},
“cordova-plugin-file”: {},
“cordova-android-support-gradle-release”: {
“ANDROID_SUPPORT_VERSION”: “27.+”
},
“com.moust.cordova.videoplayer”: {}
},
“platforms”: [
“android”
]
}
}

config.xml

<?xml version='1.0' encoding='utf-8'?> Lippincott Gurukul An awesome Ionic/Cordova app. Ionic Framework Team

You need to add in your server script

“Access-Control-Allow-Origin”, “*”

thank you @avishai_peretz_dev for your help…
i have added but its working fine on desktop but its not working on a device …api is not getting hit …
can you plz help me out…

Your server scripts are in real server or localhost?

server script are in real server

Sound typicall CORS error, check this out

https://blog.ionicframework.com/handling-cors-issues-in-ionic/

1 Like

I faced the same problem
So I change the server to AWS.
What is your current hosting server?

What language your server script?