With Google and Intel announcing collaboration on Android for X86 Intel Architecture last month on Intel IDF, it is official that the door is open for Android to, besides ARM, support Intel CPU family. As the only open source virtual software solution under the terms of the GNU GPL v2, cross-platforms Virtualbox provide a fast and simple solution to open source Android for x86. It allows developers to develop, test or port their existing apps quickly without hardware. Standardized system images(iso/vdi) from Intel, Google and OEM partners repositories allow developer to test and validate their apps on designated platforms and get accepted earlier for targeted apps store. This is the first of a blog series aiming at introducing a customer driven solution of developing, testing and validating apps with virtual Android, unconventional installation via VDI conversion, bridged networking and integration with Android Eclipse/DDMS platform.
Oracle full visualizer for Intel X86 architecture
Oracle Virtualbox platform packages are Open Source and Cross-Platforms which support Windows, IOS, Linux and Solaris. The binaries are released under the terms of the GPL version 2 and can be downloaded at:http://www.virtualbox.org/wiki/Downloads. It support same virtual OS( in a single .vdi file) run on Windows, Linux and IOS, and is a critical key player in open source & cross-platforms ecosystem(Host OS, Virtualbox, Eclipse( Android)).
Download Google Android X86 iso image from Google
Go to Google Code site ( http://code.google.com/p/android-x86/downloads/detail?name=android-x86-2.2-generic.iso&can=2&q=), and download the Android of your preference. However, Android-x86 version 2.2 Generic and 2.3 Ginger Bread are the versions that have been tested and confirmed the support of both LAN and Wireless connection via bridged network adapter configuration. Same iso image can also been located at www.android-86.org .
Start Oracle VM Virtualbox Manager, and follow the steps below:
- Start New: 1)Name: Android-x86 2.2 Generic, 2). Operating System: Linux, 3). Version: Linux 2.6.
- Memory: 256- 512MB ( Dependent on how much memory your laptop/desktop has).
- Virtual Hard Disk: Create new hard disk
- Hard Disk Storage Type: Fixed-size storage
- Virtual Disk Location and Size: default is 8GB. Select your preferred location for the single vdi. file
Before installation, make sure your parameters are set as below:
Click Settings on the top menu, and select Storage. Click the Green + icon next to IDE Controller and add Android-x86-2.2 Generic iso image you just downloaded from Google. Then click OK.
Click Start to continue the installation:
Use Up and Down Key to move the highlighted selection to Installation - Install Android-x86 to harddisk, and then press Tab key to enter edit mode, and enter the following (case sensitive. See above):
- DATA=sda1 SDCARD=sda5
This step is very important as we need to set primary partition for Android and a logical partition for SD Card so that you can use simulated SD Card latter to transfer files. You will find this very handy.
On next screens, do the following sequentially:
- Create/Modify Partition
- Highlight the Free Space, and use <- and -> key to select New
- Select Primary
- Set 7000MB for your sda1 partition ( or your prefered size if you have a big disk)
- Select Beginning
- Select Bootable
- Select Write
- Select Yes to confirm Write
- Highlight the remaining Free Space
- Select New
- Select Logical
- Select all remain harddisk size
- Make sure do not make this sda5 bootable (do not select Bootable)
- Write the sda5 partition and confirm with yes.
- Select Quit
- You will see the following table is created:
Click OK to continue to install and complete the steps below:
- Format sda1 as ext3
- Click Yes to install the boot loader grub
- Click Yes to install /system directory as read-write
- Select Create a fake SD card
- Use all default 2047MB size
Now sit back and relax until the installation is complete. Before reboot, just remeber that you still have an Android 2.2 installation iso image loaded as virtual boot CD-rom. So you have to go back to Setting->Storage to remove the iso image. Now reboot:
Before startting to run virtual Android, you first need to click Machine on top menu and select Disable Mouse Integration. By clicking any area in Android, you mouse icon will change to a darker color, and now you are free to run Virtual Android on your laptop just like a real Android device. The complete virtual Android is saved as a single .vdi file and you can find it at C:\Users\yourname\VirtualBox VM
Popular keys for virtual Android-X86 on laptop
At the very first start, you will need to click Machine on the top menu, and select Disable Mouse Integration to enter into virtual Android( rightctrl release the mouse):
- Esc key = Back 1 screen
- Window key =back to Home Key
- Right Ctrl = Release Mouse key lock
- Right Click Mouse: Back Key
- Home = Home Button
- Alt-F1 = Enter terminal
- Alt-F7 = exit Terminal
- Menu key: Android Bottom menu
- Alt-F4: Power off
Set up SD card
Virtualbox Android has pretty much all the functionality of an Android device except for the ability of making calls, location service and proximity sensor etc (same as any emulator including Google AVD). In addition, having the ability to run Android virtually, provides an alternative solution for those who do not want to set aside a computer for this purpose. To get startted, the first step you need to do is to install the SD Card and enable install from outside Android InMarket. To Do this, first go to Setting:
- Go to Setting -> Appstore -> Storage settings ->SD card
- Mount SD card
- Format SD Card.
Connect your Virtual Android to internet as a real device
Dependent on how you connect your host laptop to Internet, you will need different network setting to connect your Android to internet:
- Wireless: If you are connected to internet via wireless adapter, before you start your virtual Android, you need to go to Setting ->Network to Enable your wireless network Adapter:
- Network Cable(Cat5): If you are connected to internet via your network port via cat5 cable, before you start your virtual Android, you need to go to Setting -> Network to Enable your network Adapter:
Bridged adapter option. All network functionalities are exactly same as real device, and offers:
- Bi-directional access for Guest and Host in single laptop.
- Bi-directional Access on a subnet.
- Bi-directional access between virtual Android’s
After selecting correct network adapter, now start your Android. Unlock your screen and type Alt+F1 to enter into Android terminal window, and enter very typical Linux command: netcfg. If you see your eth0 obtained an IP address from your DHCP server, your Android is connected to Internet:
Lets get some free apps loaded before shopping Google Android Market
Start your Brower and confirm that your virtual Android is connected to internet like a real device:
Then, start AndAppStore, and get some free apps for your Android Apps development and testing. Currently there are around 5000 apps listed in Android-x86 2.2 AndAppStore :
One of app that I found of most useful is File Expert (Utilities::File & Disk Management) that you can setup a Web share and FTP shareon your virtual Android so that you can freely download and upload files, which are very convenient when you start to build your development environment:
You can set up your own user name and password for increased security.
Develop and test your Android Apps ( .apk package)
Google apps are all packaged with .apk extension, and put in /system/app folder. With virtual Android-x86, you can easily upload/download your .apk package:
After you upload your .apk package to /system/app folder, you can get access to terminal via Alt-F1 and run the following command:
chown 1000:1000 /system/app/yourpackage.apk
Then your app will show up in Android menu.
Test different screen size and resolution
By default, Android in virtualbox is displayed in 800x600. You can easily change the screen size and resolution to your prefered size or the same size of your targeted Android device. To do this, you need to press"e" twice at Android start menu to reach grub edit menu and enter vga=ask at the end of entry as below:
Then press "b" to boot your Android, and the screen size and resolution options are displayed as below. You can select whatever the size/resolution you want to start the Android:
Android-x86 in Virtualbox vs Google Android Virtual Device (AVD)?
There is no doubt, Android-x86 in Virtualbox is way faster than Google AVD. Below are some difference:
- Fast: X86 based ( same as iOS or WP7 emulator)
- Only emulate User-mode
- OS image(.vdi) easy to transfer, customizable to meet different needs.
- Allow quick and convenient Snapshot
Google AVD in Google Android SDK:
- Slow- ARM based(ARM-eabi)
- Full system QEMU: emulate whole guest system.
- Additional Dalvik VM, need to run bytecodes for Android Apps