react-native android : Possible Unhandled Promise Rejection (id: 0): TypeError: Network request failed

Viewed 112

I am trying to call fetch request and its working well in Ios but when i run in my android device that gives me error

let FETCH_ADDRESS = "https://myUrl/address";
const response = await fetch(FETCH_ADDRESS, {
  method: "POST",
  headers: utils.getApplicationHeaders(token),
  body:res
})
console.log("response",response)

const json = await response.json();
console.log("JSON",json)
return json;

i also trying add in AndroidManifest.xml

 android:usesCleartextTraffic="true"
 android:networkSecurityConfig="@xml/network_security_config"

in network_security_config.xml

  <?xml version="1.0" encoding="utf-8"?>
     <network-security-config>
        <base-config cleartextTrafficPermitted="true"/>
     </network-security-config>

error is

Possible Unhandled Promise Rejection (id: 0): TypeError: Network request failed

enter image description here

0 Answers
Related