如何从Genymotion android模拟器访问本地主机?

时间:2022-06-03 18:52:25

I can not figure out how to access localhost from a Genymotion android emulator. By the way, Im using MAMP.

我不知道如何从Genymotion android模拟器访问localhost。顺便说一下,我在用妈妈。

9 个解决方案

#1


144  

Update

更新

After genymotion update to 2.2 you can use 10.0.3.2, ref

在genymotion更新到2.2之后,您可以使用10.0.3.2,ref

Another approach

另一种方法

To access your localhost through Genymotion is using your PC IP address. to get your IP address go to:

要通过Genymotion访问本地主机,需要使用PC IP地址。获取你的IP地址:

start -> cmd -> ipconfig

then search for IPv4, copy the IP and paste it in your URL. It should looks like the following:

然后搜索IPv4,复制IP并将其粘贴到URL中。它应该如下所示:

String YourURL = "http://192.168.0.106:8888/your_script_location.php";

Hope this works too for you, give me a feedback.

希望这对你也有用,给我一个反馈。

P.S: if it didn't work, turn off the firewall and any anti-virus application you have in your PC.

P。S:如果它不起作用,关掉你电脑上的防火墙和任何杀毒软件。

#2


17  

The IP returned by ipconfig dit not work for me. However 10.0.3.2 worked for me even though the IP address in the Wifi setting is 10.0.3.15.

ipconfig dit返回的IP对我不起作用。虽然Wifi设置的IP地址是10.0.3.15,但是10.0.3.2还是对我起作用。

Genymotion 2.2.0

Genymotion 2.2.0

#3


11  

it works for me by using http://192.168.56.1:8080

我可以使用http://192.168.56.1:8080

to know your IP just use the following command

要了解您的IP,只需使用以下命令

  • for (mac and linux) ifconfig vboxnet0
  • for (mac和linux) ifconfig vboxnet0。
  • windows command ipconfig vboxnet0
  • windows命令ipconfig vboxnet0

and make sure the port is collect.

确保端口是被收集的。

I got the answer from : here

我从这里得到了答案

#4


11  

you need this structure

你需要这个结构

Genymotion

Genymotion

http://10.0.3.2/

http://10.0.3.2/

Default AVD

默认AVD

http://10.0.2.2/

http://10.0.2.2/

the http it's very important and the port it's for default It depends on your server.

http很重要,它的端口默认取决于你的服务器。

you can check this url in your browser the smartphone

你可以在你的浏览器智能手机上查看这个url

如何从Genymotion android模拟器访问本地主机?

#5


5  

Intro:

Long story short, Genymotion is running on Virtualbox, and the default network configuration is “Host-Only.” This method essentially emulates a physical network that is shared by your Genymotion VM (the emulator) and your host machine. The name of the network is vboxnet0, and if you run “ifconfig vboxnet0” (or “ipconfig vboxnet0” if running Windows) on your host machine, you should receive the IP address of your host on the vboxnet0 network. The default IP is most likely 192.168.56.1.

长话短说,Genymotion在Virtualbox上运行,默认的网络配置是“仅主机”。该方法实质上模拟了一个物理网络,该网络由Genymotion VM(仿真器)和主机共享。网络的名称是vboxnet0,如果您在主机上运行“ifconfig vboxnet0”(或者在运行Windows时运行“ipconfig vboxnet0”),您应该在vboxnet0网络上接收主机的IP地址。默认的IP很可能是192.168.56.1。

Solution:

This is the IP address to use when accessing your host machine from the Genymotion emulator. For my Rails app, this meant calling “192.168.56.1:3000” instead of “10.0.2.2:3000.”

这是在从Genymotion模拟器访问主机时要使用的IP地址。对于我的Rails应用,这意味着调用“192.168.56.1:30 000”而不是“10.0.2 2:3000”。

Link:

http://bbowden.tumblr.com/post/58650831283/accessing-a-localhost-server-from-the-genymotion

http://bbowden.tumblr.com/post/58650831283/accessing-a-localhost-server-from-the-genymotion

#6


5  

Genymotion! It works for me using IP 10.0.3.2 but depends on your localhost port. Apache it will be just IP and Tomcat with default port 8080. Here I take screenshots.

Genymotion !使用IP 10.0.3.2对我来说是可行的,但这取决于您的本地主机端口。Apache它将只是具有默认端口8080的IP和Tomcat。在这里我把截图。

1. Apache Screenshot

1。Apache截图

如何从Genymotion android模拟器访问本地主机?

2. Tomcat Screenshot

2。Tomcat截图

如何从Genymotion android模拟器访问本地主机?

Hope this is helpful. Thanks!

希望这是有帮助的。谢谢!

#7


1  

When i used genymotion in my ubuntu

当我在ubuntu中使用genymotion的时候

i used the ip address of the virtual machine as local host and it worked .

我使用虚拟机的ip地址作为本地主机,它工作了。

in virtual box goto file > preferences > network > select host only network and select adapter tab copy the ipv4 address and use it instead of localhost ...

在虚拟框goto文件>首选项>网络>只选择主机网络,选择adapter选项卡复制ipv4地址,使用它代替localhost…

like http://192.168.56.1/qrstuff/json/

比如http://192.168.56.1/qrstuff/json/

#8


0  

  1. run xampp(def 127.0.0.1:80) and go to Control Panel\All Control Panel Items\Network and Sharing Center
  2. 运行xampp(def 127.0.1:80)到控制面板\所有控制面板项目\网络和共享中心
  3. select connection
  4. 选择连接

如何从Genymotion android模拟器访问本地主机?

#9


0  

Check your Internet Connection on PC first, then Turn on Wifi in your Genymotion Emulator Device

首先检查电脑上的网络连接,然后在Genymotion模拟器设备上打开Wifi

After goto Cmd by Pressing ctrl+r then type Cmd and hit enter you will see an command line window

按下ctrl+r后,输入Cmd,点击enter,你会看到一个命令行窗口

type ipconfig and hit enter...

输入ipconfig并点击enter…

here you can see your ipv4 address type it in your Genymotion Emulator Device's Browser now you can connect to your local webserver....

在这里你可以看到你的ipv4地址类型在Genymotion模拟器设备的浏览器现在可以连接到您的本地网络服务器....

#1


144  

Update

更新

After genymotion update to 2.2 you can use 10.0.3.2, ref

在genymotion更新到2.2之后,您可以使用10.0.3.2,ref

Another approach

另一种方法

To access your localhost through Genymotion is using your PC IP address. to get your IP address go to:

要通过Genymotion访问本地主机,需要使用PC IP地址。获取你的IP地址:

start -> cmd -> ipconfig

then search for IPv4, copy the IP and paste it in your URL. It should looks like the following:

然后搜索IPv4,复制IP并将其粘贴到URL中。它应该如下所示:

String YourURL = "http://192.168.0.106:8888/your_script_location.php";

Hope this works too for you, give me a feedback.

希望这对你也有用,给我一个反馈。

P.S: if it didn't work, turn off the firewall and any anti-virus application you have in your PC.

P。S:如果它不起作用,关掉你电脑上的防火墙和任何杀毒软件。

#2


17  

The IP returned by ipconfig dit not work for me. However 10.0.3.2 worked for me even though the IP address in the Wifi setting is 10.0.3.15.

ipconfig dit返回的IP对我不起作用。虽然Wifi设置的IP地址是10.0.3.15,但是10.0.3.2还是对我起作用。

Genymotion 2.2.0

Genymotion 2.2.0

#3


11  

it works for me by using http://192.168.56.1:8080

我可以使用http://192.168.56.1:8080

to know your IP just use the following command

要了解您的IP,只需使用以下命令

  • for (mac and linux) ifconfig vboxnet0
  • for (mac和linux) ifconfig vboxnet0。
  • windows command ipconfig vboxnet0
  • windows命令ipconfig vboxnet0

and make sure the port is collect.

确保端口是被收集的。

I got the answer from : here

我从这里得到了答案

#4


11  

you need this structure

你需要这个结构

Genymotion

Genymotion

http://10.0.3.2/

http://10.0.3.2/

Default AVD

默认AVD

http://10.0.2.2/

http://10.0.2.2/

the http it's very important and the port it's for default It depends on your server.

http很重要,它的端口默认取决于你的服务器。

you can check this url in your browser the smartphone

你可以在你的浏览器智能手机上查看这个url

如何从Genymotion android模拟器访问本地主机?

#5


5  

Intro:

Long story short, Genymotion is running on Virtualbox, and the default network configuration is “Host-Only.” This method essentially emulates a physical network that is shared by your Genymotion VM (the emulator) and your host machine. The name of the network is vboxnet0, and if you run “ifconfig vboxnet0” (or “ipconfig vboxnet0” if running Windows) on your host machine, you should receive the IP address of your host on the vboxnet0 network. The default IP is most likely 192.168.56.1.

长话短说,Genymotion在Virtualbox上运行,默认的网络配置是“仅主机”。该方法实质上模拟了一个物理网络,该网络由Genymotion VM(仿真器)和主机共享。网络的名称是vboxnet0,如果您在主机上运行“ifconfig vboxnet0”(或者在运行Windows时运行“ipconfig vboxnet0”),您应该在vboxnet0网络上接收主机的IP地址。默认的IP很可能是192.168.56.1。

Solution:

This is the IP address to use when accessing your host machine from the Genymotion emulator. For my Rails app, this meant calling “192.168.56.1:3000” instead of “10.0.2.2:3000.”

这是在从Genymotion模拟器访问主机时要使用的IP地址。对于我的Rails应用,这意味着调用“192.168.56.1:30 000”而不是“10.0.2 2:3000”。

Link:

http://bbowden.tumblr.com/post/58650831283/accessing-a-localhost-server-from-the-genymotion

http://bbowden.tumblr.com/post/58650831283/accessing-a-localhost-server-from-the-genymotion

#6


5  

Genymotion! It works for me using IP 10.0.3.2 but depends on your localhost port. Apache it will be just IP and Tomcat with default port 8080. Here I take screenshots.

Genymotion !使用IP 10.0.3.2对我来说是可行的,但这取决于您的本地主机端口。Apache它将只是具有默认端口8080的IP和Tomcat。在这里我把截图。

1. Apache Screenshot

1。Apache截图

如何从Genymotion android模拟器访问本地主机?

2. Tomcat Screenshot

2。Tomcat截图

如何从Genymotion android模拟器访问本地主机?

Hope this is helpful. Thanks!

希望这是有帮助的。谢谢!

#7


1  

When i used genymotion in my ubuntu

当我在ubuntu中使用genymotion的时候

i used the ip address of the virtual machine as local host and it worked .

我使用虚拟机的ip地址作为本地主机,它工作了。

in virtual box goto file > preferences > network > select host only network and select adapter tab copy the ipv4 address and use it instead of localhost ...

在虚拟框goto文件>首选项>网络>只选择主机网络,选择adapter选项卡复制ipv4地址,使用它代替localhost…

like http://192.168.56.1/qrstuff/json/

比如http://192.168.56.1/qrstuff/json/

#8


0  

  1. run xampp(def 127.0.0.1:80) and go to Control Panel\All Control Panel Items\Network and Sharing Center
  2. 运行xampp(def 127.0.1:80)到控制面板\所有控制面板项目\网络和共享中心
  3. select connection
  4. 选择连接

如何从Genymotion android模拟器访问本地主机?

#9


0  

Check your Internet Connection on PC first, then Turn on Wifi in your Genymotion Emulator Device

首先检查电脑上的网络连接,然后在Genymotion模拟器设备上打开Wifi

After goto Cmd by Pressing ctrl+r then type Cmd and hit enter you will see an command line window

按下ctrl+r后,输入Cmd,点击enter,你会看到一个命令行窗口

type ipconfig and hit enter...

输入ipconfig并点击enter…

here you can see your ipv4 address type it in your Genymotion Emulator Device's Browser now you can connect to your local webserver....

在这里你可以看到你的ipv4地址类型在Genymotion模拟器设备的浏览器现在可以连接到您的本地网络服务器....