If you need to refer to your host computer’s localhost, such as when you want the emulator client to contact a server running on the host, use the alias 10.0.2.2 to refer to the host computer’s loopback interface. From the emulator’s perspective, localhost (127.0.0.1) refers to its own loopback interface.
More details: https://developer.android.com/studio/run/emulator-networking#networkaddresses
[TOOL] A QUICK Android OTA payload dumper
Building LineageOS for an Unsupported Device.