I am working in a react-native application. Here, I am getting [AxiosError: Network Error]
in the android emulator, while calling my application specific APIs (which is hosted). But it works fine in the real android device.
Please check the below code block (App.js)
useEffect(() => {
fetch('https://uhbvn.eeslsmartmeter.in/api/users/homePageData')
.then(response => response.json())
.then(data => console.log('API response', data))
.catch((error) => { console.error('API error:', error);});
})
Note
- I get the proper response in the android real device for the same API.
- Moreover, other APIs (e.g. https://jsonplaceholder.typicode.com/todos/1) works fine in the emulator itself.