(如何)可以在Android虚拟设备使用本地计算机的网络?计算机、设备、网络、Android

2023-09-12 09:50:46 作者:齐刘海萌妹

我的网络我的电脑上运行的服务器。有没有办法让虚拟设备使用相同的网络和访问服务器?虚拟设备不会让我切换无线(可能是因为它不具有一个)。我看一下右边的唯一选项是:

I have a server running on the network my computer is on. Is there a way to allow the virtual device to use this same network and access the server? The virtual device won't let me toggle the wifi (probably because it doesn't have one). The only options I see that look right are:

无线和网络设置 - >移动网络 - >接入点名称

"Wireless & network settings" --> "Mobile networks" --> "Access point names".

我不知道该怎么填进所有这些领域虽然。如果有人拥有所有那些需要使用本地计算机互联网领域的一个例子,我倒是AP preciate吧。

I'm not sure what to fill into all these fields though. If someone has an example of all the fields that are necessary to use the local computers internet, I'd appreciate it.

虚拟设备是模拟我的Droid X(API 2.2)。我不是在寻找答案如何与服务器进行通信,但要获得在网络上,可能一个简单的测试来验证我在(现在我只是用ConnectivityManager检查)

The virtual device is emulating my Droid X (API 2.2). I'm not looking for answers on how to communicate with the server but to get on the net and possibly a simple test to verify I'm on (right now I'm just using the ConnectivityManager to check)

推荐答案

http://developer.android.com/guide/developing/devices/emulator.html

正如其中:

模拟器的每个实例运行   一个虚拟路由器/防火墙后面   服务,从您的隔离开来   开发机的网络   接口和设置,并从   因特网。一个模拟装置不能   看到你的开发机或其他   在网络上仿真器实例。   相反,它只能看到,这是   通过以太网连接到一   路由器/防火墙。

"Each instance of the emulator runs behind a virtual router/firewall service that isolates it from your development machine's network interfaces and settings and from the internet. An emulated device can not see your development machine or other emulator instances on the network. Instead, it sees only that it is connected through Ethernet to a router/firewall."

所以,你需要使用服务器的公网IP​​(而不是它的本地网IP)。

So you'll need to use the server's public IP (as opposed to it's local network IP).