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

React native axios post request network error on Android physical device

$
0
0

( Note: I am a complete beginner in react native and have gone through a lot of reference searching for a solution and nothing helped.)I am using axios with https url for post request and this is my code.

  try {  const response = await axios.post('https://aaa.bb.com/...................',    {      headers: {        //     //Header Defination'Accept': 'application/json','Content-Type': 'application/x-www-form-urlencoded',   // tried application/json'X-Requested-From': 'MOBILE','Authorization': 'Basic '+ loginCredential,      },    },  );  console.log('Success : '+ response);} catch (error) {  // handle error  console.log(error);}

I don't need the body part. I have used the same url with data on android native version and it worked fine. But on react-native I am getting "Error: Network Error" as message without any description.Tried using android:usesCleartextTraffic="true" in manifest.

Any help would be grateful. Thank you


Viewing all articles
Browse latest Browse all 29875

Trending Articles



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