有没有办法在 android phone 设备上使用来自我的应用程序的 http 访问我的本地 API

Is there a way to hit my local API with http from my app on an android phone device

我在尝试使用我的 NativeScript 应用访问本地 API 时遇到了问题。我已将我的 API 设置为使用我的 IP 地址 198.168.1 和端口号,但我收到 clearText java 错误。我在清单中添加了 allow clearText to true 并且我尝试设置一个网络安全配置,但没有成功。

模拟器 API 路径:- http://10.0.2.2:5000。 就像您的 API 本地路径是 http://198.168.1:5000/api Then Replace With http://10.0.2.2:5000/api 并且端口地址与您的本地 API 端口一样。