Android emulator is an Android Virtual Device (AVD) that represents a specific Android device. You can use an Android emulator as a target platform to run and test your Android applications on your PC. It is a program (a process that runs on your computer’s operating system). It works by mimicking the guest device’s architecture (more on that in a bit). In order to better understand what Android emulators are capable of, you should know how they work. Mealy looking at Android Emulator, it makes up of two words, which Android and Emulator. Let look forward for the meaning of these words.
What is An Android?
Android is a mobile operating system (OS) first developed by a Silicon Valley company by the name of Android Inc. A collaboration spearheaded by Google in 2007 through the Open Handset Alliance (OHA) gave Android an edge in delivering a complete software set, which includes the main OS, middleware and specific mobile application, or app.
Patterned after the Linux kernel, the Android also was released as open source code. Development for the Android may be done through Windows, Linux or Mac. Although primarily written in Java, there is no Java Development Machine (JDM) in the platform.
Instead of allowing Java programs to run through the JDM, Google developed Dalvik, a virtual machine specifically for the Android.
Dalvik runs re-compiled Java code and reads it as Dalvik bytecode and was designed to optimize battery power and maintain functionality in an environment with limited memory and CPU power, such as that of mobile phones, netbooks and tablet PCs.
What is an Emulator?
In computing, an emulator is hardware or software that enables one computer system (term the host) to behave like another computer system (term the guest). An emulator typically enables the host system to run software or use peripheral devices designed for the guest system.
Emulation refers to the ability of a computer program in an electronic device to emulate (or imitate) another program or device. Many printers, for example, are designed to emulate Hewlett-Packard LaserJet printers because so much software is written for HP printers.
If a non-HP printer emulates an HP printer, any software written for a real HP printer will also run in the non-HP printer emulation and produce equivalent printing.
Since at least the 1990s, many video game enthusiasts have used emulators to play classic (and/or forgotten) arcade games from the 1980s using the games’ original 1980s machine code and data, which is interpreted by a current-era system.
One of the Android’s selling points is an ability to break down application boundaries. Another advantage is that it is easily developed, not to mention its speed of app development.
A large community of developers continuously devises and designs apps that enhance the capability of devices. These apps are then made available worldwide through Google’s Android Market, or other third-party sites.
A hardware emulator is an emulator which takes the form of a hardware device. Examples include the DOS-compatible card installed in some 1990s-era Macintosh computers like the Centris 610 or Performa 630 that allowed them to run personal computer (PC) software programs and FPGA-based hardware emulators.
In a theoretical sense, the Church-Turing thesis implies that (under the assumption that enough memory is available) any operating environment can be emulated within any other environment. However, in practice, it can be quite difficult, particularly when the exact behavior of the system to be emulated is not documented and has to be deduced through reverse engineering.
It also says nothing about timing constraints; if the emulator does not perform as quickly as the original hardware, the emulated software may run much more slowly than it would have on the original hardware, possibly triggering timer interrupts that alter behavior.
How to Create an Android Emulator in Windows
If you want to run an Android emulator in Windows, you have a few choices. You can configure the incredibly slow and difficult-to-use Android SDK. Or you could try the BlueStacks emulator, which is incompatible with many important apps and doesn’t provide an Android interface. But your best bet is create your own Android emulator that runs in a Window.
By creating a virtual machine that runs Android x86, a version of Google’s OS for computers with Intel/AMD processors, you can have the full Android experience in a window, complete with a desktop, navigation buttons and access to the Google Play store.
To create your own Android emulator that runs under Windows:
Step 1 ====> Download and install VirtualBox.
Step 2 ====> Download the latest version of Android x86 from android-x86.org. You will need the live and installation iSO.
Step 3 ====> Launch VirtualBox.
Step 4 ====> Click New. A dialog box appears with fields for the name and type of operating system.
Step 5 ====> Enter “Android x86” for name then select Linux and Other Linux under Type and Version and click Next.
Step 6 ====> Select at least 1024MB of RAM and click Next when prompted for memory size. If you have 8GB of RAM or more in your computer select 2048MB for the virtual machine.
Step 7 ====> Select Create a virtual hard drive and click Create when prompted to choose a drive.
Step 8 ====> Select VDI then click Next when prompted to choose a hard drive type.
Step 9 ====> Select Dynamically allocated or Fixed Size then click Next when asked what type of drive you want to use. A fixed size virtual hard drive will be a little faster, but will immediately eat up a certain amount of storage space on your real-life storage drive.
A dynamically allocated drive file will only use as much space as it needs and grow up to the amount you set. So, if you have a dynamically allocated 8GB drive but only use 2GB, the file will only take up 2GB of your hard drive.
Step 10 ====> Select 8GB and click Create when prompted for storage size. You can choose a greater drive size if you plan to install a ton of apps, but otherwise, 8GB should be more than enough for your emulator. An icon for Android x86 appears in VirutalBox’s left window pane.
Step 11 ====> Right click Android x86 and select Settings.
Step 12 ====> Set the video memory to at least 64MB under the Display submenu.
Step 13 ====> Select the Optical drive under the storage submenu.
Step 14 ====> Click the optical drive icon under attributes and select Choose a CD/DVD disk file.
Step 15 ====> Select the Android x86 ISO file you downloaded earlier then Click Ok.
Step 16 ====> Click Start with Android x86 selected. The virtual box will boot off the ISO file and present an install menu.
Step 17 ====> Select Installation from the menu.
Step 18 ====> Select Create/Modify Partitions and Click Ok. A partition menu appears.
Step 19 ====> Select New then Primary to create a single, primary partition on your virtual hard drive. Click Enter to configure the partition to use all available space on the virtual hard drive.
Step 20 ====> Select Bootable then Write and type yes to confirm. Then select Quit to return to the installation program.
Step 21 ====> Click Ok to install onto the partition you just created.
Step 22 ====> Choose ext3 when prompted for a file system format. Click Yes to confirm. The system will now copy some files.
Step 23 ====> Click Yes when asked if you want to install GRUB.
Step 24 ====> Click Yes when asked if you want to install / system as read-write. This will allow you to make some hacks if you choose to in the future. The system will now copy a few files.
Step 25 ====> Select Devices ====> CD/DVD Devices ====> Remove disk from virtual drive from VirtualBox’s top menu bar then click Force Unmount from the dialog box.
Step 26 ====> Select Reboot and click Ok. The system will boot into Android and after offering you the chance to boot to Debug or regular mode.
Step 27 ====> Step your way through Android setup as you would on any phone or tablet, entering your Google account info and changing any settings you like. Don’t configure Wi-Fi because VirtualBox already gets its Internet connection from your PC. After hitting the “Start button” on the welcome screen, there may be a minute or two delay.
Step 28 ====> Select Disable Mouse Integration from the VirtualBox Machine menu to make sure your mouse pointer stays synced with your movements.
Use the right CTRL key to move your mouse pointer out of the VirtualBox window. Hitting Right CTRL + C will allow you to scale the Android window as you resize it.
How to Install and Run the Android Emulator On Mac
Running Android emulator on Mac requires the steps bellow, fill free as you will have it done in a moment.
Step 1 ====> Download the Android SDK: Download the Android SDK, and unzip it somewhere. I placed the android-sdk-mac_86 folder in my /Applications/ folder, but you can put it wherever you want.
Step 2 ====> Optional Add to System Path: Since we are using the command line you might find it useful to add the android-sdk-platform/tools folder to your system path so you can run the android commands from any folder. If you are interested in doing that, Google provides instructions here.
Step 3 ====> Install Android Platforms: At this point, I tried running the emulator command, but the SDK doesn’t contain any Android Platforms, the Android platform is essentially Android OS, you need to install at least one version (eg 1.6, 2.1, 2.2, etc) to run the emulator.
To install platforms run the android command located in the tools folder of the SDK (use Terminal.app on a Mac, or the Command Prompt on Windows, Linux folks you know what to do :).
This will pop up a window. Select Available Packages, pick some platform versions and install.
Step 4 ====> Create a Virtual Device: Still in the android tool, click on Virtual Devices on the left, and then click New. Here’s an example of the settings for the new device
Once you create the avd file, it should show up in the listing of Android Virtual Devices:
Step 5 ====> Run the emulator: Now select the virtual device you just created and click Start on the right, and the emulator should start running