Getting this version of Android-x86 4.0.3 installed in VirtualBox is very straightforward. The main thing is you have to choose Linux 2.6:
And under the Network settings, you have to add port forwarding for port 5555 so that connections on your host system go to the virtual machine running Android-x86. This is needed so you can run adb for debugging later:
When you boot the ISO, hit tab to edit the boot options to change the resolution. Add "UVESA_MODE=" to change the resolution. Here's how you change it so your screen is 1024x600 which is a standard 7" tablet size:
At this point, you should see the ICS desktop; you may have to pretty <ctrl>-i to get the mouse to show up...it seems to sporadically need this for some reason.
You next want to turn off the lockscreen because it doesn't seem to recognize the mouse in lockscreen mode, so you'll never be able to unlock it :-)
Bring up the ICS settings and set the developer option to stay awake:
Next, bring up the Terminal Emulator app. Use the command "su" to become root and then do "ifconfig eth0" to see if your networking is up. If it's up, it should have an IP address of 10.0.2.15 if you're using VirtualBox's NAT support. If it's not up, you'll have to use the commands "ifconfig eth0 dhcp" and "ifconfig eth0 up" to set it to use DHCP and bring the network up. You can then set the DNS server by doing "setprop net.dns1 8.8.8.8" to use Google's DNS server, and then you can ping a remote site to make sure it works. Lastly, run "adb tcpip 5555" to tell adb to use the network instead of listening to the USB port. Here's what it should look like:
Next we'll have to set up MotoDev Studio to talk to this virtual machine.
Make sure you have the Device Management view open in Eclipse (not the ADT Devices view which is fairly useless). Right click on Remote Device and click New and name it VirtualboxVM:
Then set it to use IP address 127.0.0.1 and port 5555:
It should show up as Disconnected after you do this. Next, right click on the Disconnected and choose Connect. If you don't do this, you won't be able to add a run/debug configuration for it.
Right click on your project and choose Run As, Run Configuration. Then click on the Browse button to the right of the Device field and choose VirtualboxVM:
Your app should now show up on ICS running in VirtualBox :-)
You can set up a debug configuration and debug the same way.
The only negative is the Android Market isn't available in this build of Android-x86 4.0.3.
I sometimes get these error messages in the console, but they don't seem to be harmful:
An established connection was aborted by the software in your host machine
java.io.IOException: An established connection was aborted by the software in your host machine
at sun.nio.ch.SocketDispatcher.write0(Native Method)
at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:33)
at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:72)
at sun.nio.ch.IOUtil.write(IOUtil.java:43)
at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:334)
at com.android.ddmlib.JdwpPacket.writeAndConsume(JdwpPacket.java:213)
at com.android.ddmlib.Client.sendAndConsume(Client.java:575)
at com.android.ddmlib.HandleHeap.sendREAQ(HandleHeap.java:348)
at com.android.ddmlib.Client.requestAllocationStatus(Client.java:421)
at com.android.ddmlib.DeviceMonitor.createClient(DeviceMonitor.java:854)
at com.android.ddmlib.DeviceMonitor.openClient(DeviceMonitor.java:822)
at com.android.ddmlib.DeviceMonitor.processIncomingJdwpData(DeviceMonitor.java:781)
at com.android.ddmlib.DeviceMonitor.deviceClientMonitorLoop(DeviceMonitor.java:649)
at com.android.ddmlib.DeviceMonitor.access$100(DeviceMonitor.java:42)
at com.android.ddmlib.DeviceMonitor$3.run(DeviceMonitor.java:577)
Thanks to Julia Perdigueiro (tech lead for Motodev) for answering all my dumb questions about setting up remote adb debugging with Motodev.
And thanks to Popa Adrian Marius for patching a version of Android-x86 with networking support.
If you find this technique useful for Android development, please take a moment to contact the android-x86 project and ask them to include Marius' networking patches by default.
p.s., if anyone figures out how to install Android-x86 4.0.3 to the virtual machine's disk, please let me know. I haven't been able to do this with any version except 2.2 :-P
1. Mik2k08/20/2012 12:47:19
Thank you very much, now they appear in the motodev run configurations ;)
all the best \o\
2. Paul Warren03/31/2012 12:28:08
Homepage: http://www.edocr.com/doc/24336/android-developers-london
It is so good and informative! Thanks for your good sharing!<br><br>
Su | Mo | Tu | We | Th | Fr | Sa |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |