react native android9 axios network error
![](http://www.cncsto.com/contentimg/2.jpg)
react native 发布成apk后网络请求会报 network error 是因为android9以后http协议不能用,要用htts协议。需要改成配置能兼容http协议,修改信息如下:
android:networkSecurityConfig="@xml/network_security_config"
android\app\src\main\res 目录新增两个文件 network_security_config.xml 和 update_file_provider.xml 配置信息如下
"1.0" encoding="utf-8"?><base-config cleartextTrafficPermitted="true"> base-config> "system" />
"1.0" encoding="utf-8"?>"http://schemas.android.com/apk/res/android"> "root" path="" /> "files" path="Android/data/com.xtzh/files/Download" /> "cache" path="." /> "external" path="Android/data/com.xtzh/files/Download" /> "update_cache" path="Download" /> "update_external_cache" path="." />
原文:https://www.cnblogs.com/majiabin/p/14767972.html