Access localhost on laravel valet from Android emulator

Viewed 1303

I'm using laravel valet to serve an API on a Mac. How can you access it from an Android emulator

2 Answers
  1. Edit the /etc/hosts file on your Android Emulator following the instructions in this SO answer.
  2. Add the following to this file:
myapp.test  10.0.2.2

This will route requests made to myapp.test to 10.0.2.2, which is a static IP address that an AVD uses instead of localhost to access the host.

Related