Android Emulator

A tool for creating Android virtual devices (including software and virtual hardware) on your personal desktop is known as Emulator. We can use these virtual devices as the target device to run and test our Android applications on our computer. The Android emulator has almost all the functions of a real device.

We can answer incoming calls and reply to text messages. It can also locate devices and simulate different network speeds such as 4G LTE, WCDMA, GSM. The Android emulator can simulate rotation and features other hardware sensors like GPS, proximity sensor, Gyro-meter, etc. We can also utilize the Google Play store, etc.

Android Emulator

Testing and Debugging Android applications on the virtual device are often quicker and easier than doing on a real device. This is due to the reason that you can transfer data much quickly to the virtual device than to a real device connected through USB or any other means.

A lot of predefined configurations for several Android devices such as phones, smart TV comes along with the Android Emulator.

Hardware Prerequisites

You need SDK version 26.1.1 or higher and a PC/laptop with a 64-bit or 86-bit processor for using the Android emulator. If you want to run your virtual device onthe Android 8.1 versionor higher, you need a webcam that can capture 720p resolution video.

To improve the performance of the virtual device you might need to turn on hardware acceleration in system boot settings. To do this, you need HAXM version7.2.0, which is an Intel hypervisor.

Windows and Linux users need more components, depending on the processor family:

  • Intel: Supports Intel VTx and Intel EM64T (Intel 64); performs bit deactivation (XD).
  • AMD: Android Studio v3.2 or higher; support AMD virtualization (AMD-V); SIMD extension set; Windows hypervisor platform API.

Installing the Emulator

The Android emulator is installed when the Android Studio installation happens. However, some emulator components might not be downloaded or installed during the Android Studio installation.By selecting the Android emulator component on the software development kitTools tab of the SDK Manageryou can install the other emulator components required.

Run an Application on Emulator

To launch the Android Emulator and run an application:

1.  In Android Studio, we must create an Android Virtual Device (AVD) using the inbuilt AVD Manager that the emulator can use to run your android application. Follow the below mentioned steps for creating an Android Virtual Device:

  • By clicking onthe AVD Managericon on the Navigation bar you can open the Android Virtual Device Manager.
Android Emulator
  • At the bottom left of the AVD Manager, Click on Create Virtual Device option. Then Select Hardware windowwill appear.
Android Emulator
  • Select a hardware profile as per your requirement and then click on the Nextbutton. If you are unable to find the hardware profile youneed, then you can make a new or import a hardware profile. After this, The System Image window will appear.
Android Emulator
  • Now select a system image from the given table according to your need and then click on the Next button. After this, a Verify Configuration window opens.
Android Emulator
  • Change Android Virtual Device properties if needed, and then click on the Finishbutton.

2. In the navigation bar, select the Android Virtual Device on which you want to run your android application from the drop-down menu.

Android Emulator

3. At last, ClickRun.

Launch the Emulator using command Line

Using the emulator command, we canlaunch an emulator. It is an alternative way to run our android application or launch through the AVD Manager.

The basic command-line syntax for launching a virtual device is as follows:

$ emulator -avd Pixel_2_API_28 [ {-option [value]} ... ]  

or

$ emulator @ Pixel_2_API_28[ {-option [value]} ... ]  

Ifyou want tolaunch the emulator from Android Studio on a Mac operating system, the default command line will be as follows:

$ /Users/user_name/Library/Android/sdk/emulator/emulator -avd Pixel_2_API_28 -netdelay none -netspeed full  

To display the list of AVD names, enter the following command:

$ emulator -list-avds  

Stop an emulator and Clear the Data

From the Android Virtual Device Managerwindow, we can control the emulator as follows:

Android Emulator
  • To launch an Android emulator using AVD manager, double-click the Virtual device, or click on the Launch icon.
  • To stop the running emulator, right-click the Virtual device and select Stop option or click the Menu and then select Stop option.
  • If you want to delete the data and cache from an emulator and return it to the new state, then right-click a device and select Wipe Data. Or click the menu and then select the Wipe Dataoption.

Related Topics

Android Project Folder Structure

JetBrains community developed Android Studio, the official IDE (Integrated Development Environment) for Android app development and is freely distributed by Google. After the complete Android Architecture setup, we can construct an...

4 minutes read.

Broadcast Receiver in Android with Example

When a device wakes up, receives a message, receives an incoming call, switches to aeroplane mode, or initiates any other system-wide action, it is said to have been broadcast in...

5 minutes read.

Button Widget in Android Tutorial

Explanation: Button is a widget under Buttons section which is used to execute specific code. Example: XML file: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity">     <Button         android:id="@+id/button"         android:layout_width="wrap_content"    ...

1 minute read.

Android Navigation Drawer

A sliding menu used to show important links in the Android Application is called Navigation Drawer. The navigation drawermakes it easier to navigate between the fragments. It is not displayed...

5 minutes read.

Top Programming Languages for Android Development

For mobile apps, there are so many programming languages. You would need to spend days simply researching if you had to pick one from a list of 30 coding languages...

8 minutes read.

Assets folder in Android

You might have noticed that unlike the Eclipse ADT (App Development Tools), the Android Studio does not have an Assets folder, which is mainly used to store the web resources...

3 minutes read.

How to show image on an android application

ImageView Widget in Android What you should already KNOW? You should be familiar with: 1) Creating, building, and running apps in Android Studio 2) Basics of android widgets   Explanation: Image View widget is used...

2 minutes read.

Android Tutorial

This Android tutorial will provide you with all the concepts that will be beneficial for both beginners and advanced-level students or candidates. You can learn this tutorial to begin your...

6 minutes read.

How to insert the mobile number on an android application using EditText

Number Insertion in android application: Sometimes while dealing with numbers, we don't want to insert any string inside an number so, we premiliary define an EditText so we externally specify...

2 minutes read.

What is Android Studio

Android Studio powered by the IntelliJ platform is an integrated development environment (IDE) and is officially recognized for developing androidapplications. Its foundation lies on JetBrains' IntelliJ IDEA and is specialized...

3 minutes read.

Android Date picker example

How to pick date from the user in Android? Write an android example to pick date from the user and display it. Android provides control for the user to pick a date...

3 minutes read.

How to Update Gradle in Android Studio?

The Android Gradle plugin adds a number of features that are unique to develop Android apps to the Gradle build system, which is the foundation of the Android Studio development...

2 minutes read.

Android Toast

Android is one of the most successful operating systems available in today's world. It is an open-source phone platform, compatible with almost all the devices. There are numerous features and...

3 minutes read.

Android Activity

What is an Activity? Android Activity is a screen in the user interface of an Android application. In this way, Android activity is very similar to the desktop application window. An...

4 minutes read.

Android Styles and Themes

Android styles allow you to design the appearance (for example, colors, size, and fonts) of Android UI components from XML resource files. With this method, you only need to set...

5 minutes read.

Different Ways to Create aar File in Android Studio

A file called an Android archive file (*.aar) can be created using Android Studio and comprises classes and methods that use related files and classes for Android. The Android library...

4 minutes read.

Android Broadcast Receivers

Android applications can send or receive broadcast messages from the Android operating system and other Androidapplications, like the publish-subscribe design pattern. When an event of interest happens,these broadcasts are sent. For...

4 minutes read.

Android ScrollView

A ScrollView is a view group that is used to create vertically scrollable views in an android application. Only a single direct child can be contained by ScrollView. For placing...

5 minutes read.

Android Studio Resources

To build an outstanding Android application there are many items that you need to use. Aside from the coding of your application, you need to handle various resources such as...

5 minutes read.

Top 7 Android App Development Books

Do you want to create Android apps but don't know where to start? One should first be familiar with the basics of Android before we discuss these books. With the...

5 minutes read.