Introduction: Creating an Android Emulator Using Qemu
As a part of an academic research I've done during the last summer, I have created an android operating system emulator on a Linux computer using Qemu. After installing the Android emulator, I am able to use the Android system as if I were using a Android smartphone; I can surf the internet, listen to music and play games of the Android system. I find this project very interesting and the Android emulator is a fun to play with, thus I will show you how to create your own Android emulator on your computer and I hope your will have fun doing so.
Note: I did this project on a computer with Linux Ubuntu operating system, hence all my instructions may only apply to Ubuntu machines. The general concepts should be applicable to Windows systems using VirtualBox or VMWare, however, I don't know the specific steps for Windows machines.
Step 1: Step 1: Installing Qemu
Qemu is a hardware virtualization software that obscures the actual physical hardware specifics of the machine from the higher level software programs. Such virtualization software, Qemu, enables the installation of different operating systems without the operating systems being directly linking to the hardware machine. This ability presented by Qemu is crucial to the creation of an Android emulator on a computer. Smartphones and computers are similar in that they both have CPU chips to process information, however, with the differences physical dimensions between the two devices, their CPU chips are not the same in terms of architecture. Just like cars and airplanes, while they all have engines to power their movements, their engines are not the same. With different CPU architectures, a smartphone operating system can't be directing installed and used on a normal computer.
Since we are creating an Android emulator on a computer instead of installing one on a smartphone, we'll first have to install Qemu on our computer; Qemu allows us to run an Android operating system image on our computer. Installing Qemu is easy; just type in the "sudo apt-get install" as shown in the picture above in the system terminal, the system would then automatically download and install the Qemu project for you. If you're not login to your machine as the root user, the terminal would prompt your to enter your computer password before the installation.
Step 2: Step 2 Download Android OS .iso Image
Go to the Android-x86.org website to download an Android OS .iso image (http://www.android-x86.org/download).
Once we are in the Android-x86.org website, we'll need to go to the Download tap that is located at the top left side of the web page.
Under the Download page, click on the Android-x86 4.4 folder; the folder is shown as the first listed option in the picture. In the Android-x86 4.4 folder, we will need to click on the "Download Android-x86 ISO file" option to download the Android OS image we need.
Step 3: Step 3: Create a Script to Run the Qemu
In Linux systems, when a program is initiated to be executed in the terminal as a command, the user are often given the abilities to add different options when executing the command with different flags. For example, the ls command in Linux is the command to show a list of directory contents for the current working directory (folder). By adding a "-author" flag after the ls command, the result would include in the author of each files.
For the Qemu software to work with the Android OS image, we will need to add in specific option flags each time we execute qemu to start our emulator. These numerous option flag are tedious to type in and often or not, we may forget one or two. To avoid future frustration, we can create a script file. A script file is a file that contains all the terminal commands we want to execute. Instead of manually typing in the commands, we can write our commands into a script file and run the script file each time we want to start our Android emulator.
To create a script file is easy. In the system terminal, type "nano <filename>.sh" (place your own file name at the <filename> place), this will open up a text editor as shown in the picture. Then in the text editor type in the commands as shown in the picture. After we have finished writing our script, we can exit and save the file by pressing "ctlr+x" and confirm when asked if we want to save the file by pressing "y".
To execute the script we wrote, we will need to first make it into an executable by entering the command "chmod u+a yourfile.sh" in the terminal with the working directory (folder) pointed set to the directory containing your script file. Then, when we want to execute the file, we can just enter the command "./qemu.sh" in the terminal.
Step 4: Step 4: Executing the Android Emulator
To execute the Android emulator, we will need the script file we wrote in step 3, and we will also need to know the directory location of the Android OS image. As we've done so in step 2, we downloaded the Android OS image file by using a web browser. If so, we can find the Android OS image file in our Download folder, which is the directory "/home/<user>/Downloads/" (the <user> field should be the user name of your own computer user).
Once we have located the Android OS image file, we can start our Android emulator by typing in "./qemu.sh <AndroidOS_directory>/android-x86-4.4-r5.iso". When entering the directory for your Android OS image file, you can use "tab" button to auto-complete or find valid directories names. Once the command is executed, the Qemu screen will open up with the Android OS image already loaded. The screen will print several options as presented in the picture. For a quick start, we can just chose the first option by highlighting the option using the up for down keys and confirm with the enter key.
Step 5: Step 5: Advanced Development
By following steps 1-4, we have create a simple Android emulator on our computer. However, the Android emulator we've created is a very simple one; it can't save and load files between uses. To do that, we will need to create a hard disk image for the Android system to save all it's changes. This step requires deeper understandings of how the computer memory system works and how Linux systems handles, create, and format memory space into different disks. To explain and present all the necessary steps to create, configure, and install a hard disk image file for the Android system is too hard to do within a few slides and pictures. Thus, we will not cover this step in our tutorial.
If you're interested in perfecting your Android emulator by creating your own hard disk file, I suggest you to look through the instructions shown in the picture, which can be found at http://www.android-x86.org/documents/virtualboxhowto. Please do realize that these steps don't cover all the necessary steps to complete a hard disk file installation.
8 Comments
2 months ago
Awesome!
Question 3 years ago
Where do you get that eeepc.iso file, is it the android iso because the one i got is name android....iso, what is that file and where does it come from????
3 years ago
I do not recommend this Instructable for its objective, which is to run an Android Emulator. An Emulator would be required to run an alien hardware architecture like ARM on today's common x86-64 PCs and is what QEMU can do. But, the author pairs QEMU with something that does not require QEMU's functionality which is an x86 ISO image of Android. If the objective is to run an x86 ISO image of any time, then you don't need QEMU... Alternatives like Virtualbox and VMware Player are common and free alternatives which can deliver far better performance. And, there many other "better" alternatives that are a bit more difficult like KVM, Xen, UML, All preferable to QEMU for this use.
4 years ago
While these are good instructions, it's definitely worth noting that this is not how to set up an Android emulator. The author has written a good, basic guide to creating any x86-64 VM in QEMU on a Linux host and then walks thru the basic setup of the Android-x86 project installation within the VM. Android-x86 is an awesome project, but it's not an Android emulator--it's an attempt to graft the AVM and Android UI/userland onto the x86-64 Linux kernel. This is worlds of difference away from actually setting up QEMU to emulate an ARM processor and booting an actual Android system image, which is possible and a completely different process from what's described here. (If the author is reading this, I highly recommend you give a few extra sentences to explaining what the Android-x86 project is and more of an acknowledgement to that team; you really are standing on the shoulders of giants by using their work in this article.) If you're developing for Android, you certainly want to emulate it running on ARM for testing purposes--Android-x86 will not serve your testing needs well as it is not a 1:1 equivalent to the real Android OS.
5 years ago
Thanks for the how to, i suggest you to improve it adding that you can Instead of write a script use virt-manager (or sometimes gnome boxes) that is more graphical and final user oriented, and it will improve a lot the article if it is added.
7 years ago
Is it possible to fix the mouse input so that we don't need to click and drag to move it? I haven't found anything on their website about the issue. It makes using the VM cumbersome.
7 years ago
Thanks for showing us how it's done!
Im surely gonna try it.
7 years ago
Thanks for sharing this!