react-native0.63.2 安卓release包无法连接网络

原因:后台测试环境接口为http开头,Android 限制了明文流量的网络请求,非加密的流量请求都会被系统禁止掉

解决方法:
1、在android/app/src/main/res目录下新建一个xml目录,在xml目录中新建名为network_security_config.xml的 文件,内容如下

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <base-config cleartextTrafficPermitted="true" />
</network-security-config>

2、在android/app/src/main目录下的AndroidManifest.xml文件中application标签内声明文件

android:networkSecurityConfig="@xml/network_security_config"	
Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐