I am trying to create an react native expo App and trying to fetch data from an external server using Node.js. The API is working fine on android emulator and can fetch data on the client side. The problem is that when I am using my android device it always gives this error:
[TypeError: Network request failed]
I have tried everything.
-
I am using my Ip address and the port of my server.
-
I have used cors on my server side.
-
I have added in app.json file the
["expo-build-properties", { "android": { "usesCleartextTraffic": true } } ]
-
I am using http instead of https.
But I still get the same error on my device when I try to fetch data.
Any thoughts on that? How can I solve this?