本机脚本:未知URL的HTTP故障响应 [英] Nativescript: HTTP failure response for unknown URL

查看:379
本文介绍了本机脚本:未知URL的HTTP故障响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个情况, 我已经从分支中提取了最新的更改,并尝试使用tns run android命令运行该应用程序. 该应用已成功启动,但API调用受到限制,一旦应用启动,就会引发错误.

I have a situation, I have pulled the latest changes from my branch and trying to run the application using tns run android command. The app is launched successfully but the API call is restricted throwing an error as soon as the app starts.

我也已经通过答案,但这似乎不是问题所在.因为对于其他团队成员来说,它工作正常. :/

I have also gone through this answer but that's not the problem it seems. Because for other team members it is working fine. :/

    err {
JS:   "headers": {
JS:     "normalizedNames": {},
JS:     "lazyUpdate": null,
JS:     "headers": {}
JS:   },
JS:   "status": 0,
JS:   "statusText": "Unknown Error",
JS:   "url": null,
JS:   "ok": false,
JS:   "name": "HttpErrorResponse",
JS:   "message": "Http failure response for (unknown url): 0 Unknown Error",
JS:   "error": {
JS:     "originalStack": "Error: java.io.IOException: Cleartext HTTP traffic to elk.chennai-volunteer-294695.staging.c66.me not permitted\n    at new ZoneAwareError (file:///data/data/org.nativescript.chennaivolunteersapp/files/app/
tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js:1298:33)\n    at onRequestComplete (file:///data/data/org.nativescript.chennaivolunteersapp/files/app/tns_modules/tns-core-modules/http/http-request/http-request.js:
45:34)\n    at Object.onComplete (file:///data/data/org.nativescript.chennaivolunteersapp/files/app/tns_modules/tns-core-modules/http/http-request/http-request.js:37:13)",
JS:     "zoneAwareStack": "Error: java.io.IOException: Cleartext HTTP traffic to elk.chennai-volunteer-294...

推荐答案

从Android 9.0(API级别28)开始,默认情况下禁用明文支持.

Starting with Android 9.0 (API level 28), cleartext support is disabled by default.

使用android:usesCleartextTraffic标志更新清单文件.

Update your manifest file with the android:usesCleartextTraffic flag.

<application ... android:usesCleartextTraffic="true" ...>

这篇关于本机脚本:未知URL的HTTP故障响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆