React Native:https 请求上的 Axios 网络错误

问题描述

我正在尝试使用 React-Native 中的 Axios 框架从定制的 API 中获取数据。 在 iOS 上一切正常。但是在 Android 设备(不是模拟器)上,我总是收到“网络错误”消息。

请求网址:https://subdomain.mydomain.de/xxxx/xxx.php (GET)

我还在我的域中将 android:networkSecurityConfig="@xml/network_security_config" 添加Android 清单(调试和发布)。

我的network_security_config.xml 如下所示:

<network-security-config>
    <!-- deny cleartext traffic for React Native packager ips in release -->
    <domain-config cleartextTrafficPermitted="true">
        <domain includeSubdomains="true">localhost</domain>
        <domain includeSubdomains="true">10.0.2.2</domain>
        <domain includeSubdomains="true">10.0.3.2</domain>
        <domain includeSubdomains="true">mydomain.de</domain>
    </domain-config>
</network-security-config>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)