Skip to content Skip to sidebar Skip to footer

Network Error When Use Axios In React Native

This is long-standing problem for me and I can't find solution at all. Within my react native project(react-native-cli), I send request to server using axios package. But when I'm

Solution 1:

I think this is a problem with http and https request. SO to enable https request try the one below :

The easy way to implement this is to use this attribute to your AndroidManifest.xml where you allow all http for all requests:

android:usesCleartextTraffic="true"

Solution 2:

try adding bellow code in AndroidManifest.xml

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

Solution 3:

For Android, instead of using: localhost, use 10.0.2.2.

Post a Comment for "Network Error When Use Axios In React Native"