skip to Main Content

I am using Android Gradle Managed Devices in my project like:

devices {
        pixel2(com.android.build.api.dsl.ManagedVirtualDevice) {
            device = "Pixel 2"
            apiLevel = 30
            systemImageSource = "google"
        

Everything is working fine in my local, but when I tried to run into a docker image, I am always getting this error:

* What went wrong:
Execution failed for task ':mobile:pixel2Setup'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.ManagedDeviceSetupTask$ManagedDeviceSetupRunnable
   > Snapshot setup ran successfully, but the snapshot failed to be created. This is
     likely to a lack of disk space for the snapshot. Try the cleanManagedDevices
     task with the --unused-only flag to remove any unused devices for this project.

I tried with -Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect" that should work when no hardware rendering (like in github actions) and with ATD images.

The docker image has the latest commandlinetools (commandlinetools-linux-8512546_latest.zip) and I think that I am installing the correct emulator

RUN curl -sS https://dl.google.com/android/repository/${SDK_VERSION} -o /tmp/sdk.zip 
    && mkdir -p ${ANDROID_HOME}/cmdline-tools 
    && unzip -q -d ${ANDROID_HOME}/cmdline-tools /tmp/sdk.zip 
    && mv ${ANDROID_HOME}/cmdline-tools/cmdline-tools ${ANDROID_HOME}/cmdline-tools/latest 
    && rm /tmp/sdk.zip 
    && yes | sdkmanager --licenses 
    && yes | sdkmanager "platform-tools" 
        "emulator" 
        "platforms;android-$ANDROID_BUILD_VERSION" 
        "build-tools;$ANDROID_TOOLS_VERSION" 
        "system-images;android-30;google_apis;x86" 
    && rm -rf ${ANDROID_HOME}/.android 
    && chmod 777 -R /opt/android 

I googled and I only found this issue: https://issuetracker.google.com/issues/235119877

Do you have any suggestion?

2

Answers


  1. Chosen as BEST ANSWER

    Fixed upgrading AGP from 7.2.2 to 7.3.0


  2. Try to remove the quotation marks around the swiftshader parameter. Solved the problem in my case:

    -Pandroid.testoptions.manageddevices.emulator.gpu=swiftshader_indirect
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search