How can I access my localhost from my Android device?

前端 未结 30 2257
面向向阳花
面向向阳花 2020-11-21 05:53

I\'m able to access my laptop web server using the Android emulator, I\'m using 10.0.2.2:portno works well.

But when I connect my real Android phone, th

30条回答
  •  我在风中等你
    2020-11-21 06:39

    ngrok lets you put your localhost onto a temporary server and is very simple to set up. I've provided some steps here that can be found in the link:

    1. Download the ngrok zip from the link above
    2. Open the zip
    3. Run your server locally and take note of the port number
    4. In the terminal, go to the folder where ngrok lives and type ngrok http [port number]

    You'll see a little dashboard in your terminal with an address pointing to your localhost. Point your app to that address and build to your device.

提交回复
热议问题