簡體   English   中英

Android Gradle Docker 圖像中的托管設備

[英]Android Gradle Managed Devices in Docker image

我在我的項目中使用 Android Gradle 托管設備,例如:

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

在我的本地一切正常,但當我嘗試運行 docker 圖像時,我總是收到此錯誤:

* 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.

我嘗試使用-Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect"它應該在沒有硬件渲染(如 github 操作)和ATD圖像時工作。

docker 圖像具有最新的 commandl.netools (commandl.netools-linux-8512546_latest.zip),我認為我正在安裝正確的模擬器

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 \

我用谷歌搜索,只發現了這個問題: https://issuetracker.google.com/issues/235119877

你有什么建議嗎?

嘗試刪除 swiftshader 參數兩邊的引號。 解決了我的問題:

-Pandroid.testoptions.manageddevices.emulator.gpu=swiftshader_indirect

修復了將 AGP 從 7.2.2 升級到 7.3.0 的問題

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM