Search code examples
androidandroid-gradle-plugingitlab-ci

Run Android Gradle Managed Device on Gitlab CI


Locally it works correct, but on Gitlab CI I have the error:

enter image description here

Device config:

testOptions {
    managedDevices {
        devices {
            illusionDevice (com.android.build.api.dsl.ManagedVirtualDevice) {
                device = "Pixel 2"
                apiLevel = 30
                systemImageSource = "aosp-atd"
            }
        }
    }
}

Indirect shaders property is enabled:

android.testoptions.manageddevices.emulator.gpu=swiftshader_indirect

My test project - https://gitlab.com/illuzor/gradle-manager-devices-test

Failed build - https://gitlab.com/illuzor/gradle-manager-devices-test/-/jobs/3656625078

Is it possible to find out the cause of the problem?


Solution

  • It is impossible to run gradle managed devices on gitlab ci or github actions. Agents are runs on x86 on docker. Emulator with x86 requires acceleration. Docker can't use hardware acceleration.

    https://developer.android.com/studio/run/emulator-acceleration#vm-accel-restrictions