export const apiClient = axios.create({
baseURL:
`http://${Platform.OS == 'android' ? '10.0.2.2' : 'localhost'}:8080/api/v1`,
});
When using an Android emulator (AVD), localhost
refers to the emulator itself, not your computer. To access a server running on your host machine, use 10.0.2.2
instead of localhost
. This fixed the issue for me.