Search code examples
androidandroid-emulatornativescriptnativescript-angular

Connecting the emulator to vagrant laravel homestead


i have project, its backend uses laravel and I put it to vagrant in virtualbox machine. I have succeeded to access from my local browser. and now I must build android app that calls api from the backend. but it give me error

JS: {
JS:   "headers": {
JS:     "normalizedNames": {},
JS:     "lazyUpdate": null,
JS:     "headers": {}
JS:   },
JS:   "status": 0,
JS:   "statusText": "Unknown Error",
JS:   "url": "http://izat.test:8000/api/v1/auth/login",
JS:   "ok": false,
JS:   "name": "HttpErrorResponse",
JS:   "message": "Http failure response for http://izat.test:8000/api/v1/auth/login: 0 Unknown Error",
JS:   "error": {
JS:     "originalStack": "Error: java.net.UnknownHostException: Unable to resolve host \"izat.test\": No address associated with hostname\n    at new ZoneAwareError (file:///data/data/org.nativescript.fraapp/files/app/vendor.js:91443:33)\n    at onRequestComplete (file:///data/data/org.nativescript.fraapp/files/app/vendor.js:97223:34)\n    at Object.onComplete (file:///node_modules\@nativescript\core\http\http-request\http-request.js:43:0)"
JS:   }
JS: }

btw I use nativescript-angular for building my android app. I use API 27 for android emulator


Solution

  • If you have local api path then change it like http://izat.test:8000/api to http://192.168.10.10:8000/api for local only.