Install Android in VirtualBox for Android Pentesting
Android Hacking

Install Android in VirtualBox for Android Pentesting

CybersecMastery Research Team • December 05, 2026 • 6 min read • 10 views • 0 discussions
Table of Contents
    Educational & Defensive Research Notice: The commands, tools, and technical procedures detailed in this guide are provided strictly for lawful security education, authorized penetration testing, and defense hardening. Never perform testing against any network or asset without prior written authorization. Consult our Ethical Hacking Disclaimer.

    In this article, we're going to learn how to add an Android virtual machine to VirtualBox. 

    Why?

    You might be wondering why we need a separate Android virtual machine when Android Studio already provides an emulator. 

    Well, Android Studio's emulator can consume a lot of system resources, especially RAM and CPU. Since I'm using a low-end laptop, running the Android Studio emulator can slow the system and make it unresponsive. 

    This can also be a problem for beginners without powerful hardware. So, using a prebuilt Android virtual machine in VirtualBox is a convenient alternative. It will also help us with the practical Android security testing exercises covered in our upcoming lessons.

    Finding a prebuilt Android virtual machine

    After searching online, I found a website called OSBoxes, which provides preconfigured virtual machine images for different operating systems, including various versions of Android.

    On this website, you can find different Android images. For example, there is LineageOS 14.1 R5, which is based on Android 7.0, along with Android x86 9.0 R1 and R2. There are several other versions available as well. For this tutorial, we're going to use Android x86 version 9.0. 

    Make sure you select the appropriate version rather than downloading an older one. Once you've selected the Android version, you'll find download options for both VirtualBox and VMware. Since we're using VirtualBox, select the VirtualBox image and download the 64-bit version. The download may take some time, depending on your internet connection.

    After the download is complete, you'll find a compressed archive file on your system. 

    We need to extract this archive before using it. For this, you can use WinRAR. Right-click the downloaded file and extract it to your preferred location.

    Once extracted, you'll find a directory named 64bit.  Open this directory, and inside it, you'll see a file with the .vdi extension. 

    This is called a Virtual Disk Image, or VDI file. It contains the virtual hard disk that we'll attach to our VirtualBox machine.

    Before moving ahead, keep this VDI file in a permanent location on your system. Once we've attached it to VirtualBox, avoid moving or deleting the file. Otherwise, VirtualBox may lose access to the virtual hard disk, and the virtual machine may fail to start.

    Set up the Virtual Machine

    Now, Launch VirtualBox.

    Click on the New option to create a new virtual machine. A configuration window will appear where we need to specify the virtual machine settings.

    Specify the Virtual Machine name and Operating System:

    • First, enter a suitable name for your virtual machine. 
    • Under the operating system type, select Linux.
    • For the distribution, choose Other Linux, and 
    • for the version, select Other Linux 64-bit.

    Next, expand the hardware configuration section. Here, we need to allocate memory and CPU resources to the virtual machine. 

    Set the base memory to at least 2 GB, or more if your system has enough available RAM. Similarly, assign more than one CPU core if your hardware supports it. Keep in mind that you should leave enough resources for your host operating system.

    Now, we need to configure the virtual hard disk. Since we've already downloaded and extracted a VDI file, there's no need to create a new virtual hard disk. 

    • Instead, select the option called Use an Existing Virtual Hard Disk File.
    • Click the folder icon to open the virtual hard disk selector. 
    • In this window, click Add and browse to the location where you extracted the Android virtual machine. 
    • Select the .vdi file and click Choose. 

    You'll now see that the existing virtual disk has been attached to the new virtual machine.

    Once everything is configured, click Finish to create the virtual machine. As you can see, our Android virtual machine has now been created and is visible in the VirtualBox Manager. 

    I've also organized the virtual machine list to keep everything easy to manage.

    Before starting the virtual machine, we need to configure a few additional settings. 

    Configure the settings

    Select the Android virtual machine and click Settings. 

    This will open the configuration window. VirtualBox provides two different settings views, Basic and Expert. For this tutorial, we'll use the Expert view because it allows us to access all the required configuration options in one place.

    We don't need to make any changes under the General settings. 

    Instead, move to the System section. 

    Here, look for the Pointing Device option and change it to USB Tablet. 

    This setting is important because Android may not properly detect mouse input when using the default PS/2 mouse configuration.

    Next, open the Display section and select the Screen tab. Increase the Video Memory to 128 MB. 

    Then, change the Graphics Controller to VBoxVGA.

    You may notice a warning or error icon after selecting VBoxVGA. 

    For this particular Android virtual machine, we can ignore that warning. This graphics controller can help Android display its graphical interface properly. If you use an incompatible graphics controller, you may end up with a black screen showing only the terminal instead of the Android graphical interface.

    Now, let's configure the network settings. 

    Open the Network section and change the Attached To option to Host-only Adapter. 

    This will allow our Android virtual machine to communicate with other virtual machines connected to the same host-only network.

    This configuration will be particularly useful in our upcoming Android security testing demonstrations, where we'll use Kali Linux as the attacking machine and Android as the target device. 

    Make sure your Kali Linux virtual machine is also connected to the same VirtualBox Host-only network. Otherwise, the two machines may not be able to communicate with each other.

    Once all these settings are configured, click OK to save the changes.


    Our Android virtual machine is now ready. Select it and click Start to power it on.

    Our Android virtual machine is now ready. Select it and click Start to power it on.

    As you can see, Android has started booting inside VirtualBox. After a few moments, the Android operating system loads, and we can see its graphical interface.

    That's it. We've successfully created and configured an Android virtual machine in VirtualBox without having to install Android Studio or use its resource-intensive emulator.

    CM
    Verified
    CybersecMastery Research & Editorial Group
    Verified Security Analysts

    Authored and peer-reviewed by certified information security practitioners (CEH, OSCP & CompTIA Security+ aligned). All lab commands, scripts, and exploit walkthroughs are tested in isolated environments before publication.

    Defensive & Offensive Security Peer-Reviewed Guides Editorial Standards & Team

    Community Q&A