0% found this document useful (0 votes)
507 views6 pages

What Are Android Emulators

An Android emulator is a program that runs on a computer and creates a virtual Android device with software and hardware. It works by mimicking the hardware of the guest device. The Android emulator by Android Studio uses QEMU to emulate hardware and can use hardware-assisted virtualization for faster emulation if the guest and host architectures match. While emulators allow testing apps, real Android devices are needed for thorough testing of performance, native features, and compatibility across different devices.

Uploaded by

Arun
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
507 views6 pages

What Are Android Emulators

An Android emulator is a program that runs on a computer and creates a virtual Android device with software and hardware. It works by mimicking the hardware of the guest device. The Android emulator by Android Studio uses QEMU to emulate hardware and can use hardware-assisted virtualization for faster emulation if the guest and host architectures match. While emulators allow testing apps, real Android devices are needed for thorough testing of performance, native features, and compatibility across different devices.

Uploaded by

Arun
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

What are Android Emulators?

An Android emulator is a tool that creates virtual Android devices (with


software and hardware) on your computer. Note that:

 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.

How do Android Emulators Work?


Complete platform-virtualization (hardware and software emulation) is possible with Quick
Emulator (QEMU).

 Quick Emulator (QEMU)


QEMU–shorthand for Quick EMUlator. It’s an open-source and incredibly versatile tool.
It can run on a large variety of host (workstation) CPUs/OSs and emulate an even larger
range of guest CPUs/OSs.

QEMU powers most Android emulators (including the one by Android Developer
Studio).

How it Works: It mimics guest device hardware. Then it translates the Application
Binary Interface (ABI) of the guest device to match with host device. You equip this
with an OS and run it like a program on your computer.

The translation of CPU architectures is a complex, time-consuming process which makes


emulation almost painfully slow. Thankfully, it can be skipped if the guest and the host
CPU architectures are the same, with the help of a hypervisor.

 Hypervisors
Before 2017, Android Developer Studio’s emulator had to translate Android’s ARM
architecture to match the Intel/AMD architectures commonly used in PCs.

With the release of version 25.3.0, Developer Studio upgraded their emulator to support
hardware-assisted virtualization.

How it works: When the guest and the host devices have same instruction architecture
(say, x86 Android system images and x86 Intel processor), QEMU skips the ‘binary
translation’ part and runs the guest device directly on the host CPU. This is called
hardware-assisted virtualization.

You need a hypervisor to enable this. Intel’s HAXM (Hardware Acceleration


Execution Manager) is a hypervisor component for Windows and macOS. There’s KVM
(Kernel-based Virtual Machine) for Linux.

With hardware-acceleration, the Android emulator can run virtual devices at


speeds similar to that of your workstation CPU.

Now that you know how it works, here’s a brief introduction to the most popular
Android emulator out there.

Android Emulator (by Android Developer


Studio)
Post the release of version 25.3.0, the Android Emulator is distributed
separately from Android SDK tools.

To install it from your Android Developer Studio console, go to Configure ->


SDK Manager -> Android SDK. Within this screen, under the ‘SDK Tools’
tab,  you’ll find the Android Emulator. Check the box and click OK to install
it.

The Android emulator can be tricky to set up. Here’s a brief


walkthrough:

 Hardware Prerequisites
In order to work with Android emulator, you’ll need SDK version 26.1.1
or above and a PC/laptop with 64 or 86-bit processor. If you want to
work with Android 8.1 or above, you’ll need a webcam that can capture
720p frames.
The emulator may prompt you to enable hardware-acceleration (to
speed up virtual device performance). For this, you’ll need HAXM
version 7.2.0-the Intel hypervisor we mentioned above.

Windows and Linux users will need more components, depending on


their processor family:

 Intel: Intel VT-x and Intel EM64T (Intel 64) support; Execute Disable
(XD) Bit capability.
 AMD (Linux): AMD Virtualization (AMD-V) support; SIMD
Extensions set 3.
 AMD (Windows): Android Studio v3.2 or above; Windows
Hypervisor Platform API.

Once you’re done with the installation, you’ll arrive at the Android Virtual
Device (AVD) Manager:

 Android Virtual Device Manager


AVD Manager lets you set up and configure your virtual Android
devices. Some key points:

1. Device Type: Contains pre-configured, manufacturer-specific


device profiles for TV, Phone, Tablet, and Wear OS. You can
customize screen size and certain external capabilities–or
import a profile of your own. Interestingly, the Google Play
Store and the Compatibility Test Suite are only available for a
very limited number of devices–ones that meet the Android
Compatibility Program criteria.
2. System Image: Lets you equip the virtual device with a system
image/ABI and an Android OS version. ABIs come in ARM,
x86, x86-64 variants for different Android OS versions/APIs.
Each ABI has a file size of about 900 MB. The emulator will
recommend ABIs that are similar in architecture to your
workstation processor, but you can pick others (with a trade-off
in emulator performance). Only certain system images have
Google APIs (which give you access to Google apps like Maps,
Gmail, etc.).
3. Verify Configuration: Allows you to change previously defined
hardware/software profiles and configure some startup settings
for the virtual device (name, orientation etc.)
Once you click ‘Finish’, the emulator launches the virtual device
instance with your specifications–complete with extended controls to
adjust device rotation, geolocation, camera, fingerprint sensor,
network latency, battery state, and more.

You can test your web app, a project from Android Studio or upload a
native app APK from your own device.

By default, these virtual device instances get saved in the state they
were in when you closed them. You can also save snapshots of the
device state (includes OS, your app/project, and user data) and pick up
where you left off later.

 Capabilities
Data transfer is faster on a virtual device (than a physical device
connected via USB). The drag-and-drop file upload lets you place .apk
files from your computer to the virtual mobile device. It’s particularly
great when developers need to quickly test apps under context.

The emulator is also pretty useful when you’re working with


physical sensors like the accelerometer. If you were testing a
specific app feature that relies on the sensors, it’ll be easier to configure
the settings through the visual, extended controls of the emulator.

 Limitations
The most popular chipset for Android smartphones out there is ARM
v7a. Most PCs/laptops run on Intel (x86). Recall that guest and host
CPU architectures need to match for faster emulation. Basically, without
a computer equipped with an ARM processor, you’re stuck with
poor emulation of most of the commercially-available Android
devices.

The AVD Manager creates separate directories to store each virtual


device’s user data, SD card data, and cache. A single virtual device can
take as much as 3.5GB of your disk space. Over time, a library of
virtual devices will clam up your workstation.

Virtual devices’ performance is affected by that of your workstation. The


emulator will crash and burn if you don’t have enough free disk
space at launch.
Enabling hardware-acceleration takes care of performance issues. But
setting up hardware-acceleration is a complex process that even
experienced developers struggle with. The results often lead to
complete system failure.

Android emulator isn’t reliable when it comes to understanding


app interactions with the native device environment. For instance,
you’d never know:

 Which background processes your app runs


 How front-end appears in different brightness levels
 How the app responds to a complete range of touch-gestures

Testing with Android Emulators and


Real Android Devices
In CI/CD pipelines, developers execute tests on code before committing changes to a branch.
After some quick unit testing within the IDE, functional and instrumentation testing take
precedence.

You can execute some instrumented tests on Android emulator. An example would be
verifying that the code correctly handles app-specific or core platform resource files (like
font, animations, UI, etc.), or testing to see if external dependencies on ‘sign-up via
connected apps’ (Facebook, Google etc.) functionality works.

App Performance testing is done to verify that interactions are smooth, that there’s no jank
(dropped frames), and that the app uses device resources (battery and memory) within
reasonable constraints. To get accurate results, you first need an accurate measure of the CPU
and graphics capabilities of the target device.

At best, the Android emulator can give you virtual devices running on near-native speed.
There’s no way you can expect native results with them. On virtual devices, you can’t test
your Android app’s performance against any benchmarks.

Plus-and this goes without saying-there’s no easy or reliable workaround that’d let you test
native or web apps at scale with Android emulators.

For serious, pre-release cross browser testing (on UI and all functionalities), you will need a
diverse collection of real Android devices. QA engineers use testing automation frameworks
like Appium or Espresso, write test scripts, and execute them on as many different Android
devices as necessary to meet the benchmarked compatibility standards for a given target
market.

You might also like