Quantcast
Channel: Active questions tagged react-native+android - Stack Overflow
Viewing all articles
Browse latest Browse all 29639

Fetch not working for HTTP request (mobile client - React Native and server - Java)

$
0
0

I am working on a cross-platform app using React-Native and fetch is not working for my post request (the request doesn't even arrive at the server).

I get TypeError: Network request failed everytime.

I am using http (not https). There is no problem with the server (I used a rest client and I am able to get an answer from the server)

I tried the followings:

  • added android:usesCleartextTraffic="true" in my AndroidManifest.xml

  • added network_security_config.xml in my res/xml directory and used android:networkSecurityConfig="@xml/network_security_config" to get those configurations in < application.... /> in my AndroidManifest.xml file

I have this in android/build.gradle:

    buildToolsVersion = "28.0.3"    minSdkVersion = 21    compileSdkVersion = 28    targetSdkVersion = 28

I must add that fetch is working with a mockapi.io for example.

Help, pretty please :)


Viewing all articles
Browse latest Browse all 29639


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>