反应本地android版本apk无法从Internet接收数据 [英] react native android release apk can't receive data from Internet

查看:103
本文介绍了反应本地android版本apk无法从Internet接收数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用React native开发了一个应用程序,并在设备中安装了调试APK,一切正常.

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

但是在我的设备上安装发行版时,它无法从API获取数据.

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

怎么了?

推荐答案

在我的情况下,我使用非安全(http而不是https)调用api.因此,api在调试环境中效果很好,但在发布环境中却不起作用.您可以添加此行

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"

到AndroidManifest.xml

to AndroidManifest.xml

喜欢

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

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

这篇关于反应本地android版本apk无法从Internet接收数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆