Search code examples
androiddebuggingmobilelocalhostadb

Debug mobile app from Chrome - localhost not resolved


I remember with another phone I was able to debug my local website dev, now there is a problem preventing me to open localhost in my mobile and cannot find how.

Looking at: Google Chrome for Android Remote Debugging - "localhost:9222" Not Available

my phone is connected, on localhost:9222 I can see a list of tabs.

I can access tabs loading site from remote, but cannot load my localhost.

In one case, error displayed: 408 - Timeout.

On another , simply chrome display site is not reachable. ERR_NAME_NOT_RESOLVED

I tried both with port-forward enabled as well as not (if enabled, listening to 8081, 8080).

Phone is connected via USB but seems cannot reach my localhost address of the laptop, still on same wifi spot.

EDITED

I remember with another phone I was able to debug my local website dev, now there is a problem preventing me to open localhost in my mobile and cannot find how.

I was doing with Bonjour- the "Bonjour host" is the name Mac assign to your user machine user.local. I was able to connect former android host, but now it cannot be solved anymore unless of IP.


Solution

  • The two devices should be on the same network and it won't be localhost in that case, but you have to replace localhost with the IP of the server PC!

    So instead of localhost:9222, it would be 192.168.1.10:9222 giving that 192.168.1.10 is your IP address!