我将我的React本机应用程序0.57升级到0.59。使用react-native run-android命令一切正常。但是,当我为Android创建一个Release版本并点击任何API(例如登录API)进行登录时。它在logcat上显示以下错误。
2019-08-22 14:38:13.432 16058-16222/? E/ReactNativeJS: errorTypeError: Network request failed
2019-08-22 14:38:13.444 16058-16224/? E/unknown:ReactNative: console.error: "errorTypeError: Network request failed", stack:
<unknown>@1002:3830
f@110:155
<unknown>@110:882
y@115:657
C@115:1021
callImmediates@115:3216
callImmediates@-1
value@28:2873
<unknown>@28:1264
value@28:2565
value@28:1234
value@-1
value@-1
2019-08-22 14:38:37.717 1049-1220/? E/storaged: getDiskStats failed with result NOT_SUPPORTED and size 0
2019-08-22 14:38:43.513 2286-2469/? E/SyncManager: Bind attempt failed - target: ComponentInfo{com.whatsapp/com.whatsapp.contact.sync.ContactsSyncAdapterService}
答案 0 :(得分:0)
这肯定为我解决了。
将它们添加到我的/android/app/src/main/AndroidManifest.xml
<manifest ...>
<uses-permission android:name="android.permission.INTERNET" />
<application
...
android:usesCleartextTraffic="true" // <-- added this
...>
...
</application>
</manifest>