Skip to main content

[Mobile] Configure Android Emulator

The Android Emulator simulates Android devices on your computer so that you can test your application on a variety of devices and Android API levels without needing to have each physical device. To learn more about the Android emulator capabilities and system requirements, you can refer to this Android developer document: Run apps on the Android Emulator.

In this article, we guide you step by step on how to configure Android Studio Emulator for mobile testing.

Install Appium via NPM

  1. Download and install the suitable version of Node.js for your system from the Node.js website: Downloads.
    Note:
    • Make sure you install Node.js into a location with full Read/Write permissions.

  2. Install Appium version 1.12.1 or newer via NPM. To install the latest Appium version, copy and paste the command-line argument as follows: npm install -g appium
    Note:
    • We recommend installing the latest Appium version.

    • Some emulators support Appium directly when installed. If you want to run an application on an emulator, check your emulator settings before installing Appium.
    To learn more about Appium, you can refer to the Appium document here: Getting started.

Configure Android Studio

Installation

Download and install Android Studio. You can download Android Studio from the Android developer website here: Android Studio. Android Studio will guide you through each step during the installation and automatically download the necessary components to create emulators.

Create an Android project

  1. After installing successfully, in the Welcome Page window, click Create new project. Android Studio provides a variety of sample projects for you to choose from. Here, we choose Empty Activity as an example, then click Next.

    Choose project template

  2. In the next interface, you can configure your project as follows:

    Name The name of your project.
    Package Name By default, this is generated as com.example.<projectname>.
    Save location The save location of your project. In case you want to change the default location, click Browse (folder icon).
    Language The language to build your Android app. You can select either Java or Kotlin from the dropdown menu.
    Minimum SDK The lowest version of Android supported by your app
    Use legacy android.support libraries. If your app requires legacy library support, check this box. To learn more about Android support libraries, you can refer to the Android developer document here: Support libraries

    Configure your project

  3. Click Finish. A new project window opens containing sample files to build an Android app. If you want to learn more about building an Android app, you can refer to this Android developer document: Build a simple user interface.

Create an emulator

  1. To create an emulator. In the main toolbar of the new project window, select Device manager. An Android Virtual Device Manager opens.

    Choose AVD Manager

  2. Click Create Device. The Select Hardware page opens, allowing you to choose your emulator's screen size, resolution, and pixel density. To get an overview about screen variations, you can refer to this Android developer document: Screen compatibility overview. After selecting the hardware, click Next.

    Select the hardware

  3. The Select system image page opens, asking you to select the system image for a particular API level or an Android version. To learn more about Android versions and the corresponding API levels, you can refer to the Android developer document here: Understanding Android API levels.

    Select the system image you want to test. If you see Download next to the system image you select, you need to click it to download its necessary components.

    For example: We choose the Pie Android version with an x86 system image. Pie is the code name for Android version 9.0 and API level 28. After clicking Download, you need to accept Android Software Development Kit License Agreement, then click Next to start downloading.

    Select system image

    Note:
    • Katalon Studio can only support Android version 6.0 or above. To learn more about the supported environment in Katalon Studio, you can refer to this document: Supported environment.

  4. After choosing the system image, click Next. The Verify Configuration page appears.

  5. Change the default name of your emulator if necessary, then click Finish. A new emulator appears in the Device Manager.

    Launch the emulator

Launch an emulator

To launch an emulator, open the Device Manager, select the emulator you want to launch, then click Run.

Launch the emulator

If you want to run the emulator via the command-line option, you can refer to the Android developer document here: Start the emulator from the command line.

Verify successful Android devices connection

After launching the emulator, Katalon automatically recognizes the emulator as an Android device. To check whether Katalon successfully recognizes your Android emulator, you can open a Mobile Testing Sample Project in File > New sample projects > Sample Android Mobile Tests Project. Katalon Studio will detect and ask you to install Android SDK automatically if your current machine does not have it.

Open Android sample project

On the main toolbar, select the Android device in the dropdown list next to Run.

Recognize Android devices

You should see the name of your emulator appear as an Android device.

Note:
  • You must first manually launch the emulator with Android Studio or via the command-line option for Katalon to recognize the device.

Choose emulator in Katalon

You can now execute mobile testing with the emulator.

Was this page helpful?