I can't seem to get the following Axios call to work on Android. It's not hitting the server and showing the error : [Error: Network Error]. The same code works on iOS. Do I have to do something special to enable network requests for Android on React Native?
var url = 'https://***.****.com/api/list';
axios.get(url,
{ headers: {'Content-Type': 'application/json'}}
).then((response) => {
console.log("response = ",response.data)
})
.catch((error) => {
console.log("error = ", error)
});
I got this error in console :
error = > Error: Network Error
at createError (index.bundle?platfor…minify=false:117949)
at XMLHttpRequest.handleError (index.bundle?platfor…minify=false:117857)
at XMLHttpRequest.dispatchEvent (index.bundle?platfor…&minify=false:32349)
at XMLHttpRequest.setReadyState (index.bundle?platfor…&minify=false:31433)
at XMLHttpRequest.__didCompleteResponse (index.bundle?platfor…&minify=false:31260)
at index.bundle?platfor…&minify=false:31370
at RCTDeviceEventEmitter.emit (index.bundle?platfor…e&minify=false:5652)
at MessageQueue.__callFunction (index.bundle?platfor…e&minify=false:5080)
at index.bundle?platfor…e&minify=false:4793
at MessageQueue.__guard (index.bundle?platfor…e&minify=false:5034)