[React Native(RN)/android] How android emulator connect localhost server?

1. Problem

When we want to connect localhost server of laptop or computer server port on Android emulator, we usually try http://localhost or But Android emulator cannot access this port. What should I do to connect to the localhost currently running on my computer?

2. Solution

The solution is so simple. You can use The emulator (Android) are operating systems. When you call localhost on this emulator, it becomes itself. So even if i call api, i can’t connect to the server.

If you look at the Android Emulator networking settings, it says that you can access it with a special address called