我在我的项目中使用Android Gradle Managed Devices,如:
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映像具有最新的命令行工具(commandlinetools-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
你有什么建议吗?
1条答案
按热度按时间ajsxfq5m1#
试着去掉swiftshader参数周围的引号。在我的例子中解决了这个问题: