In this series of Android Tutorials, today we are going to discuss Android Emulator. It is an Android Virtual Device (AVD) that represents a virtual Android device. We can use the emulator as a testing device to perform and examine our android application on the personal computer. The Android emulator provides us almost all the functionality of a real android device. We can access phone calls and text messages. It also allows us the functionality of the live location of the current device. The emulator affects rotation and other hardware sensors. It also accesses the Google Play store and many more.
The Android emulator comes with predefined configurations for various Android phones, Wear OS, tablets, Android TV devices.
The Android emulator needs additional requirements exceeding the basic system requirement for Android Studio.
These requirements are:
- SDK Tools 26.1.1 or higher
- 64-bit processor
- Windows: CPU with UG (unrestricted guest) support
- HAXM 6.2.1 or later (recommended HAXM 7.2.0 or later)
To install the emulator component, select the Android Emulator component in the SDK Tools tab of the SDK Manager.
Run an Android App on Emulator:
We can run an Android app form the Android Studio project, or we can run an app that is installed on the Android Emulator since we run any app on a device.
To start an Android Emulator and run the app:
1. First, we need to create an Android Virtual Device (AVD) that the emulator can use to install and run your app.
To create a new AVD:-
- Open the AVD Manager by clicking Tools > AVD Manager.
- Click on Create Virtual Device, at the bottom of the AVD Manager dialog. Then Select Hardware page appears.
- Select a hardware profile and then click Next. If you don’t see the hardware profile you want, then you can create or import a hardware profile. The System Image page appears.
- Select the system image for the particular API level and click Next. This leads to open a Verify Configuration page.
- Change AVD properties if needed, and then click Finish.
2. Go to the toolbar; choose the AVD, to run our app from target devices from the drop-down menu.
3. Then Click Run.
Launch the Emulator without first running an app:
To start the emulator:
- Open the AVD Manager.
- Double-click an AVD, or click Run
While the emulator is running, we can run our project and select the emulator as the target device. We can also drag the APKs file to install on an emulator, and then run them.
Launch the Emulator with Command Lines (CMD)
1. Make sure you set the path of ANDROID_SDK/emulator is in your environment path variable, this path contains emulator.exe
2. Now open the terminal and write the code: emulator –list-avds
3. At last, run the emulator using this command
** Change according to your emulator name
And make sure you have already install JAVA JDK and Android Studio with Android SDK build tools.
Hope you like it. For more visit GBAndroidBlogs