对于React本机项目
它已经固定在0.59雷恩。
你可以找到
upgrade diff from 0.58.6 to 0.59
您可以在不升级RN版本的情况下应用它,请执行以下步骤:
创建文件:
android/app/src/
debug
/res/xml/react_native_config.xml
-
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="false">localhost</domain>
<domain includeSubdomains="false">10.0.2.2</domain>
<domain includeSubdomains="false">10.0.3.2</domain>
</domain-config>
</network-security-config>
android/app/src/
debug
/AndroidManifest.xml
-
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<application tools:targetApi="28"
tools:ignore="GoogleAppIndexingWarning"
android:networkSecurityConfig="@xml/react_native_config" />
</manifest>
检查接受的答案以了解根本原因。