This article will explain how to install the official Android emulator as a standalone application in Linux. The official Android emulator comes with the “Android Studio” application development suite. However, if you are not interested in developing Android apps and just want a working emulator without installing Android Studio, this article should help you. All the steps mentioned in the article are tested on Ubuntu 20.04 LTS version.
Install Command Line Tools
Download the latest version of “Android Command Line Tools” from here (scroll down to the command line section).
Extract the downloaded archive and make a new folder named “tools” inside “cmdline-tools” directory. Copy and paste all files from “cmdline-tools” folder to “tools” folder. Your final directory layout should look like this:
├── bin
├── lib
├── NOTICE.txt
├── source.properties
└── tools
Install Required Packages
Go to the “tools/bin” folder, launch a new terminal window and run the following command to update repository details:
Next, run the following command to list available and installed packages:
Install some packages required for the Android emulator to work:
Find Correct System Image to Use
Next you need to make a note of the system image you want to load in the Android emulator. To get a list of downloadable system images, run the command below:
You should get some output similar to this:
You will see some numbers like “27”, “28” etc. in the name of system images. These numbers denote Android API levels. Find the Android version corresponding to the API levels from here and make a note of the appropriate system image you want to use in the emulator and the API level number.
Download System Image and Corresponding Packages
Next, download the following packages using the same API level number you finalized in the step above:
For instance, if you decided to use “system-images;android-29;default;x86_64” as the system image, the command would change to:
You can always use the “list” switch to find correct command and version numbers:
Create a New AVD
AVD or “Android Virtual Device” is a set of configuration parameters that defines values for a virtual device that will emulate a real Android hardware device.
To create a new AVD, you need to use the system image you downloaded in the step above. Run the following command to create a new AVD:
Replace “my_avd_30” with any name of your choice. You may be prompted to alter some configuration parameters. Follow on-screen instructions and change the values as per your requirements.
Confirm that the AVD has been successfully created using the command below:
You should get some output similar to this:
Name: my_avd_30
Path: /home/nit/.android/avd/my_avd_30.avd
Target: Google Play (Google Inc.)
Based on: Android 11.0 (R) Tag/ABI: google_apis_playstore/x86_64
Sdcard: 512 MB
Note the path of AVD in the output above. At the same path, you can find a “config.ini” file that can be used to change configuration parameters of the AVD.
Run Emulator
Go to “emulator” folder (up a few directories) and use the following command to launch the emulator:
Replace “my_avd_30” with the name of your own AVD you created in the step above. Your Android emulator should be now up and running:
You can create as many as AVDs as you want and each AVD / System Image will be treated separately.
Conclusion
Android emulator provides an excellent way to emulate real life Android devices on your desktop PC. You can use the emulator to test some apps that are yet in development or you can use the emulator to regularly run Android compatible apps and games on a Linux PC. The performance of the emulator will depend on your system’s horsepower, virtualization technologies available on your PC and your system’s compatibility with the KVM kernel module.