react-native0.63.2 安卓release包无法连接网络
react-native0.63.2 安卓release包无法连接网络原因:后台测试环境接口为http开头,Android 限制了明文流量的网络请求,非加密的流量请求都会被系统禁止掉解决方法:1、在android/app/src/main/res目录下新建一个xml目录,在xml目录中新建名为network_security_config.xml的文件,内容如下<?xml version="
·
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"
更多推荐
已为社区贡献2条内容
所有评论(0)