问题描述
我在我的设备中开发了一个带有React Native并安装调试APK的应用程序,所有的东西都可以.
但是当在我的设备中安装释放版本时,它无法从API获取数据.
怎么了?
推荐答案
在我的情况下,我用非安全(http而不是https)调用api.因此,API适用于调试环境,但不能用于发布.您可以添加此行
android:usesCleartextTraffic="true"
到androidmanifest.xml
就像那个
<uses-permission android:name="android.permission.INTERNET" /> <application ... android:usesCleartextTraffic="true" ...
问题描述
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?
推荐答案
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" ...