(OK) Running Android in a VirtualBox VM


https://www.ricston.com/blog/running-android-virtualbox-vm/


The first question that may come to mind after reading this blog post’s title is: “Why would I want to run Android in a VM when I have the emulator?”. For me it boils down to two main reasons:

  1. Android runs significantly faster in a VM compared to the emulator.
  2. VirtualBox offers support for devices such as Bluetooth whereas the emulator doesn’t. This means you can test Android Bluetooth applications in a VM.

There are two ways to make Android run on a VirtualBox VM. The first approach is well known: download the Android x86 fork and follow instructions from the fork’s project website to create a bootable ISO file. From there on, it’s easy to install Android on a VM. The drawback to this approach is that you won’t have the latest Android code. Additionally, changes you make to the fork must be merged with the AOSP (Android Open Source Project) for them to be included in future releases of Android.

The second approach gives you direct access to the latest Android code. However, it’s barely documented due to the fact that previously you couldn’t build ‘out of the box’ an Android VDI (Virtual Disk Image) with the AOSP. To build the Android VDI and install it in your VM, follow these steps:

  1. Get the Android source code from the AOSP site and follow the online instructions to setup the environment.


  2. When you are ready to build the project, execute the following command to set the environment variables for Make: “lunch vbox_x86-eng”.


  3. Run “make installer_vdi” to build the project. Make will build the project and produce a VDI named “installer.vdi” located in “out/target/product/vbox_x86”. This VDI contains Android plus its installer.


  4. Create a Linux VM and add the “installer.vdi” as an extra HD to the VM.


  5. Start the VM and press “F12” during bootup.


  6. Select the HD which represents the “installer.vdi”.


  7. Choose the first option, that is, “Android Install to /dev/sda from /dev/sdb”.


  8. When installation is complete, enter the command “reboot”. After that, you should be able to launch Android from your VM.


One small note, I had several problems trying to compile Android for VirtualBox from my Mac OS X. So probably the best solution is to build Android from Linux.


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值