1

I have my MAMP Pro set up to be able to access my host via local network, I believe through NAMO.

My host is named myproject.local and I am able to access my site at myproject.local:8888 on most devices connected to my network. My laptop and iPhone both are able to access this host using this domain.

However, unsurprisingly, my Android device fails to connect and just says the site can't be reached...

Of course, I tried to just do this using the Android Emulator (using the 10.0.2.2 address), but my Android Emulator won't start because it just stops responding as soon as it opens up... :dumpter-fire:

What lovely Android-specific thing do I need to do to get it to work with this very simple concept of local networks?

BlondeSwan
  • 772
  • 5
  • 26
  • Is this problem related to this? https://stackoverflow.com/questions/51902629/how-to-allow-all-network-connection-types-http-and-https-in-android-9-pie? – Rômulo Bourget Novas Jun 07 '21 at 18:58
  • I don't believe so because it's not just my app can't connect, it's the whole Android Phone. Like, I can't even access the `myproject.local:8888` domain through the phone's web browser like I can on my iPhone's web browser. – BlondeSwan Jun 07 '21 at 19:00
  • Oh... okay... have you tried accessing through your machine IP address on the local network? Get it from `ifconfig` or any other cli of your preference and try configuring it in your app to access it directly from 'X.X.X.X:8888'. – Rômulo Bourget Novas Jun 07 '21 at 19:04
  • Yup, the problem is this is through MAMP. So that address points to `localhost:8888` not `myproject.local:8888` – BlondeSwan Jun 07 '21 at 19:06

1 Answers1

1

Case 1:

If you are using real android phone or iphone, you need to install mamp viewer in you mobile. Then you need to connect your mobile and mamp server with the same network. So you can view your website via mamp viewer or mobile browser. This is how I connect from my real iPhone.

Note: for now mamp viewer in real android phone is not working anymore. Maybe it will be working in the future.

enter image description here

Case 2:

If you are using emulator (AVD), you can access only localhost. So you need to put your code in localhost folder. After that you can test with your emulator browser as below

http://10.0.2.2:8888

enter image description here

Piseth Sok
  • 1,789
  • 1
  • 20
  • 24