I'm using laravel valet to serve an API on a Mac. How can you access it from an Android emulator
Asked
Active
Viewed 1,662 times
2 Answers
1
- Edit the /etc/hosts file on your Android Emulator following the instructions in this SO answer.
- 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.

Cameron Wilby
- 2,222
- 1
- 25
- 35
0
As the Android Emulator is different computer than your Mac, you should use the IP address of the Mac (or its name if it is resolved on your network) instead of localhost.
For example if your Mac has IP address 192.168.1.10
, then use this address.

Xvolks
- 2,065
- 1
- 21
- 32
-
Even if i use the IP of the Mac it gives a message "Valet - 404 Not Found" – YKalinde Aug 14 '17 at 08:30
-
If you receive a 404, you probably getting the web server at the wrong URL. Check it. – Xvolks Aug 14 '17 at 08:33
-
I don't know why it is downvoted. This is also a solution with a proper explanation. Also if you receive Valet - 404 Not Found, it means you already have connected. – Ataberk Nov 15 '22 at 17:08