[Mobile] Configure Android Studio (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 in Katalon.

Requirements:

  • Appium installed. To learn more about installing 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 AVD manager. An Android Virtual Device Manager opens.

    Choose AVD Manager
  2. Click Create Virtual 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

    Notice:

    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 AVD Manager.

    Launch the emulator

Launch an emulator

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

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.

Execute mobile testing with Android Studio in Katalon

After launching the emulator, Katalon automatically recognizes the emulator as an Android device. To check whether Katalon successfully recognizes your Android emulator, on the main toolbar, select the Android device in the dropdown list next to Run.

Regconize Android devices

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

Notice:

  • 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. To learn more about creating and executing mobile testing in Katalon, you can refer to the below documents:

Feedback