Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

( 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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
788 views
Welcome To Ask or Share your Answers For Others

1 Answer

Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...