Sunday, June 03, 2012

Install Android in VirtualBox with Internet connection

  1. Download a "Buildroid for VirtualBox" OVA file at http://www.buildroid.org. There are 3 versions: for "phone", for "tablet" and for "tablet" with phone capabilities. [There is a Buildroid image with Market/Play app but "for testing purpose only".]
  2. Import the Buildroid image into Virtualbox: File --> Import Appliance...
  3. Install Google Play Store app (and other apps) (in Windows):
    • Get the adb (Android Debug Bridge) utility from Android SDK (http://developer.android.com/sdk/index.html) or download the adb at https://sites.google.com/site/keyablefile/adb-win.zip (including adb.exe and AdbWinApi.dll).
    • Download the app at http://buildroid.org/Download/buildroid-gapps-ics-20120317-signed.tgz
    • VirtualBox: Settings --> Network --> Adapter 1 --> Attached to: NAT; Advanced --> Port Forwarding --> Insert new rule: both Host Port and Guest Port = 5555. [Multiple virtual machines: increment the host port (5556,...) and keep the same guest port for each machine.] [Adapter 2 is used for emulating a Wifi connection.]
    • Start Buildroid virtual machine. Open Buildroid VM Configuration, there should be the IP address under IP Management.
    • In Windows Explorer, go to the folder containing adb.exe; Shift-right click --> Open command window here. [Check adb help for options and parameters.]
      • adb connect localhost (or adb connect the_above_IP_address)
      • adb push path\to/buildroid-gapps-ics-20120317-signed.tgz /sdcard/ (copy the .tgz apps file to Android)
      • adb shell
      • su
      • mount -o remount,rw /system
      • tar -xvzf /sdcard/buildroid-gapps-ics-20120317-signed.tgz
      • mount -o remount,ro /system
      • reboot
    • The Adroid machine will reboot and there should be Google apps including Market/Play.
Ref:
- http://keyable.blogspot.jp/2012/05/how-to-run-android-40-in-virtualbox.html
- http://www.buildroid.org/blog/?page_id=121

Install Android in VirtualBox

  • Dowwnload android-x86-4.0-RC1-eeepc.iso or android-x86-4.0-RC1-asus_laptop.iso from http://www.android-x86.org/download.
  • Create a new virtual machine on VirtualBox. OS type: Linux, version Linux 2.6. Memory: 512 MB or 1000 MB. Create a new boot harddisk. Adjust the settings: Sound: Sound Blaster 16; Network: NAT (or Bridged), adapter: PC-net-FAST III
  • Install Android. Choose Install Android-x86 to harddisk from the boot menu. Create one partition for the full harddisk, formatted as ext3. Install the boot loader GRUB. When the installation finishes, select "Run Android x86" to boot the Andoid. (Before the next booting, remove the CD image from Settings-Storage-IDE Controller.)
  • To make the mouse work in the virtual machine, go to “Machine” in the menu and select “Disable mouse integration” (right Ctrl, by default, to restore the mouse in host machine). Alt-1 and Alt-7 to enter command line or go back to graphical interface. Shutdown the machine by command-line (halt) or from menu of VirtualBox. Press Esc to exit standby mode.
  • To connect the Internet (from command line, tested with NAT):
    • netcfg to list the devices.
    • dhcpd eth0
    • setprop net.dns1 8.8.8.8
Ref:
- http://maketecheasier.com/install-android-4-0-ice-cream-sandwich-in-virtualbox/2012/03/02
- http://groups.google.com/group/android-x86/browse_thread/thread/eb88bb948176f6b8
- http://groups.google.com/group/android-x86/browse_thread/thread/ec0aee3a027775d7

Note:
  • By the above method, the Internet can be accessed using browser, but other apps cannot access the Internet (they need "wifi").
  • To access the Internet with other apps: see http://keyable.blogspot.jp/2012/05/how-to-run-android-40-in-virtualbox.html