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

时间:2021-07-11 23:58:55

标签: android react-native networking axios get

我正在尝试使用 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>

0 个答案:

没有答案