将模拟器连接到 vagrant laravel homestead

Connecting the emulator to vagrant laravel homestead

我有一个项目,它的后端使用 laravel,我把它放到 virtualbox 机器中的 vagrant。我已经成功地从我的本地浏览器访问。现在我必须构建 android 从后端调用 api 的应用程序。但它给我错误

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: }

顺便说一句,我使用 nativescript-angular 构建我的 android 应用程序。 我将 API 27 用于 android 模拟器

如果您有本地 api 路径,则将其更改为 http://izat.test:8000/api to http://192.168.10.10:8000/api 仅适用于本地。