Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 725
miladsolgi Avatar asked Nov 29 '22 05:11

miladsolgi


1 Answers

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"
      ...
like image 159
Nam Avatar answered Dec 09 '22 17:12

Nam