I am trying to configure a Android x86 running machine using Oracle VirtualBox so that it works with Eclipse. I am having some trouble in making my virtual machine "online". I connected the phone to adb by typing the following in the Android Terminal Emulator:
ifconfig eth0 192.168.40.1 netmask 255.255.255.0
route add default gw 192.168.40.1 dev eth0
Afterwards, I switched to cmd and typed adb connect localhost
But when I try to run my test code using Eclipse on the virtual Android, it does not appear in the Android Device Chooser Menu. Furthermore, when I typed adb devices
in cmd, this was the response:
List of devices attached
localhost:5555 offline
The other thing that worries me is that each time after I shut down the VM, I have to type the ifconfig
and route add
commands again in the terminal when I restart, in order to connect to the device.
What can I do to make the device online?
EDIT: In case it matters, the VM is configured to communicate over a NAT Network. This is what my Port Forwarding Rules look like: Protocol: TCP
Host IP: *
Host Port: 5555
Guest IP: *
Guest Port: 5555
EDIT2 Related Question: Error: device offline
EDIT3: Potential Solution: Android device chooser - My device seems offline
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.