How can I access my localhost from my Android device?

前端 未结 30 2323
面向向阳花
面向向阳花 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:21

    The easier way to default localhost is to use http://localhost:port. This works in a laptop and Android as well.

    If it does not work, then in android set the default IP of your phone to 127.0.0.1:port :)

    Open terminal and type :-

     hostname -i
     #127.0.0.1
     hostname -I
     #198.168.*.*
    

提交回复
热议问题