惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

J
Java Code Geeks
Google DeepMind News
Google DeepMind News
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
小众软件
小众软件
Blog — PlanetScale
Blog — PlanetScale
腾讯CDC
A
About on SuperTechFans
Vercel News
Vercel News
I
InfoQ
阮一峰的网络日志
阮一峰的网络日志
月光博客
月光博客
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
人人都是产品经理
人人都是产品经理
S
SegmentFault 最新的问题
V
Visual Studio Blog
T
Tailwind CSS Blog
大猫的无限游戏
大猫的无限游戏
M
MIT News - Artificial intelligence
博客园 - 【当耐特】
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Microsoft Azure Blog
Microsoft Azure Blog
Apple Machine Learning Research
Apple Machine Learning Research
GbyAI
GbyAI
美团技术团队

博客园 - 斌言

Claude Code + deepseek在Windows环境上的搭建教程 docker部署.NET6并挂载目录 unable to access 'https://github.com/langgenius/dify.git/': Failed to connect to github.com port 443 after 21111 ms: Could not connect to server .NET6 MVC 无刷新上传文件 docker快速搭建部署mqtt ubuntu安装smaba CentOS7.9安装Docker centos7.9 安装 openGauss 5.0.0 CentOS 7 yum安装MongoDB CentOS 7.4安装.NET6 react native SectionList组件实现多选 react-native-vector-icons 安装 apk文件查看指纹证书方法 server2008 安装mongodb supervisor 安装及基本使用 WinForms 嵌入 Web服务 ASP.NET Core http请求内容过大, IIS服务器 返回 Request Too Long 解决方案 ASP.NET Core MVC中调用Json()时默认使用Newtonsoft.Json返回数据 .NET Core3.1升级.NET5 oracle连接报错
react native android9 axios network error
斌言 · 2021-05-14 · via 博客园 - 斌言

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  配置信息如下

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <base-config cleartextTrafficPermitted="true">
        <trust-anchors>
            <certificates src="system" />
        </trust-anchors>
    </base-config>
</network-security-config>

<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
    <!--升级-->
    <!--<external-cache-path name="update_external_cache" path="." />-->
    <!--<cache-path name="update_cache" path="." />-->
    <!--代表设备的根目录new File("/");-->
    <root-path name="root" path="" />
    <!--context.getFilesDir()-->
    <files-path name="files" path="Android/data/com.xtzh/files/Download" />
    <!--context.getCacheDir()-->
    <cache-path name="cache" path="." />
    <!--Environment.getExternalStorageDirectory()-->
    <external-path name="external" path="Android/data/com.xtzh/files/Download" />
    <!--context.getExternalFilesDirs()-->
    <external-files-path name="update_cache" path="Download" />
    <!--getExternalCacheDirs()-->
    <external-cache-path name="update_external_cache" path="." />
</paths>