react native android release apk can't receive data from Internet

大憨熊 提交于 2019-12-24 00:55:54

问题


I developed an app with React native and install debug apk in my device and all of the things are ok.

but when install release version in my device, it can't get data from API.

what's wrong?


回答1:


In my case, I call api with non secure (http instead of https). So api work well for debug environment, but not work for release. You can add this line

android:usesCleartextTraffic="true"

to AndroidManifest.xml

like that

<uses-permission android:name="android.permission.INTERNET" />

<application
      ...
      android:usesCleartextTraffic="true"
      ...


来源:https://stackoverflow.com/questions/54418709/react-native-android-release-apk-cant-receive-data-from-internet

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!