( 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
question from:https://stackoverflow.com/questions/65661706/react-native-axios-post-request-network-error-on-android-physical-device