我在所有 API https:// too
react-native 0.65 上都遇到 Axios 网络错误。在我将其更新到 0.65 之前,我的应用程序在所有设备上都运行良好。以前的版本是 0.61。
现在仅在 Android M (6) 上出现网络错误。
我的AndroidManifest
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission
android:name="android.permission.RECEIVE_SMS"
tools:node="remove" />
<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:usesCleartextTraffic="true"
android:roundIcon="@mipmap/ic_launcher"
android:hapticFeedbackEnabled="false"
android:requestLegacyExternalStorage="true"
android:launchMode="singleTask"
android:theme="@style/AppTheme">
我的android/build.Gradle
buildscript {
ext {
buildToolsVersion = "30.0.2"
minSdkVersion = 21
compileSdkVersion = 30
targetSdkVersion = 30
ndkVersion = "20.1.5948944"
}
我的debug AndroidManifest
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:usesCleartextTraffic="true"
tools:targetApi="28"
tools:ignore="GoogleAppIndexingWarning"
>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>
"react": "17.0.2",
"react-native": "0.65.1",