Nativescript: HTTP failure response for unknown URL
我有一个情况,
我已经从分支中提取了最新的更改,并尝试使用
该应用程序已成功启动,但API调用受到限制,一旦应用程序启动,就会引发错误。
我也回答了这个问题,但这似乎不是问题所在。因为对于其他团队成员来说,它工作正常。 :/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | 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\ at new ZoneAwareError (file:///data/data/org.nativescript.chennaivolunteersapp/files/app/ tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js:1298:33)\ at onRequestComplete (file:///data/data/org.nativescript.chennaivolunteersapp/files/app/tns_modules/tns-core-modules/http/http-request/http-request.js: 45:34)\ 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)开始,默认情况下禁用明文支持。
使用
1 |
转到:
通过将
所示
1 2 3 4 5 6 7 | <application ... ... android:usesCleartextTraffic="true" ... ... </application> |