在禁用了主机GPU的情况下运行Android 5.0.1 x86虚拟设备 [英] Running Android 5.0.1 x86 virtual device with host GPU disabled
问题描述
我正在为我的一个应用程序自动化截图捕获.
I am working on automating screenshots capture for one of my apps.
由于我想捕获一些活动和窗口小部件的屏幕截图,这些活动和窗口小部件会根据系统区域设置而有所不同,因此,我针对每种所需的语言启动了一个新的Android虚拟设备(模拟器),该虚拟设备具有用于设置系统区域设置的正确属性.然后,使用 uiautomator 模拟特定的用户交互.
Since I want to capture screenshots of some activities and widgets that differ according to the system locale, I start for each desired language a new Android virtual device (emulator) with the correct properties for setting the system locale. Then, specific user interactions are simulated with uiautomator.
我的工作流程按预期工作,但是截图捕获存在问题.实际上,使用 UiDevice.takeScreenshot(File storePath) 或 screencap 在模拟器上始终会创建一个空文件.
My workflow is working as expected but I have an issue with screenshots capture. Indeed, using UiDevice.takeScreenshot(File storePath) or screencap on the emulator always creates an empty file.
运行AVD似乎是一个已知问题启用了主机GPU(我就是这种情况).建议的解决方法是在禁用主机GPU的情况下启动仿真器.不幸的是,当我在禁用Host GPU的情况下启动虚拟设备时,仿真屏幕仍保持黑色.
It seems to be a known issue with AVD running with Host GPU enabled (which is my case). The proposed workaround is to start the emulator with Host GPU disabled. Unfortunately, when I start the virtual device with Host GPU disabled, the emulated screen remains black.
我已经使用-verbose
选项和abd -e logcat
命令查看了模拟器的输出( logcat输出 >).在logcat输出中,我已经确定了以下错误,但是我无法找出原因:
I have taken a look at the output of the emulator with the -verbose
option and abd -e logcat
command (emulator output, logcat output). In logcat ouput I have identified the following error but I cannot figure out the cause of it:
E/SurfaceFlinger( 929): hwcomposer module not found
E/SurfaceFlinger( 929): ERROR: failed to open framebuffer (No such file or directory), aborting
下面是我用来启动模拟器的命令:
Below is the command I use to start the emulator:
LD_LIBRARY_PATH=$ANDROID_HOME/tools/lib:$LD_LIBRARY_PATH emulator -avd screenshots -skin nexus_6 \
-skindir $ANDROID_STUDIO_HOME/plugins/android/lib/device-art-resources -no-audio \
-prop persist.sys.language=en -prop persist.sys.country=en -verbose -qemu -m 512 -enable-kvm &
我正在使用Nvidia GPU运行Fedora 21.
有人成功启动了具有禁用主机GPU的最新系统映像的Android虚拟设备吗?欢迎任何帮助或建议.
Does someone has succeeded to start an Android virtual device with a recent system image with Host GPU disabled? Any help or suggestion is welcomed.
推荐答案
圣牛!我面临的问题是已知问题.解决方法是使用屏幕分辨率较低的皮肤(例如nexus_4).
Holy cow! The problem I am facing is a known issue. Workaround is to use a skin with lower screen resolution (e.g. nexus_4).
这篇关于在禁用了主机GPU的情况下运行Android 5.0.1 x86虚拟设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!