What Are Android Emulators
What Are Android Emulators
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.
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.
Now that you know how it works, here’s a brief introduction to the most popular
Android emulator out there.
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.
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:
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.
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.
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.