Android x86 on VirtualBox: Android Connected But Not Online

最后都变了- 提交于 2019-12-03 21:23:41

This is much easier than all of that, to enable adb over tcpip in the Android VM Terminal Emulator type:

adb tcpip 5555

Then to connect via adb from a command line on your Eclipse machine:

adb connect 192.168.40.1:5555

The VM should now be available via adb devices as well as via the device view in Eclipse.

When I've started to develop some Android application, I have to deal with the same problem, so looking for something, on the VirtualBox guide I've read that the NAT does not require any configuration on the host network and guest system and for this reason, it is the default networking mode in VirtualBox. A virtual machine with NAT enabled acts much like a real computer that connects to the Internet through a router. The "router", in this case, is the VirtualBox networking engine, which maps trac from and to the virtual machine transparently. In VirtualBox this router is placed between each virtual machine and the host. This separation maximizes security since by default virtual machines cannot talk to each other. The disadvantage of NAT mode is that, much like a private network behind a router, the virtual machine is invisible and unreachable from the outside internet. The network frames sent out by the guest operating system are received by VirtualBox's NAT engine, which extracts the TCP/IP data and resends it using the host operating system. To an application on the host, or to another computer on the same network as the host, it looks like the data was sent by the VirtualBox application on the host, using an IP address belonging to the host. VirtualBox listens for replies to the packages sent, and repacks and resends them to the guest machine on its private network.
The virtual machine receives its network address and configuration on the private network from a DHCP server integrated into VirtualBox. The IP address thus assigned to the virtual machine is usually on a completely different network than the host. As the virtual machine is connected to a private network internal to Virtual-Box and invisible to the host, network services on the guest are not accessible to the host machine or to other computers on the same network. However, like a physical router, VirtualBox can make selected services available to the world outside the guest through port forwarding. This means that VirtualBox listens to certain ports on the host and resends all packets which arrive there to the guest, on the same or a different port. So, executing cmd, go to the folder where the VirtualBox is installed and where the VBManage.exe is and type this in order to apply the TPC port forwarding:

VBoxManage modifyvm "NameOfYourAndroidVM" --natpf1 adb,tcp,*,5555,*,5555

Now you can connect to your virtual machine through adb with:

adb connect localhost

Just configure the vm to use the pridge network mode and have a dhcp server enabled on the network.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!