Gradle Managed Devices: The Future of Android Testing [Part 1]

Andres Sandoval
3 min readMay 21, 2023

Android Automation Testing with Gradle Managed Devices using Android Studio

The new Android Gradle plugin helps developers run test on virtual/real devices. Testing Android applications as part of the CI process can get complicated, sometimes it’s hard to have a stable environment to run Android test automation. Google is helping developers with creating virtual Android devices to run your tests. With the new Gradle plugin you will write your test, then configure inside your file “build.gradle” which device you want your tests to run on. More details here Scale your tests with Gradle Managed Devices | Android Developers.

Goal

Run Android tests on cloud devices using Gradle Managed Devices.

Prerequisites

  • Use the latest Android Studio
  • Use the latest Gradle managed devices is table in AGP (Android Gradle Plugin) 8.2.+

Steps

Below are the instructions to configure your Android project to use GMD (Gradle managed devices).

1. Add below code snippet inside file build.gradle(app) example

android{
...
testOptions {
managedDevices {
localDevices {
register("pixel6api33") {
// Use device profiles you typically see in Android Studio.
device =…

--

--