Running Android 5.0.1 x86 virtual device with host GPU disabled

徘徊边缘 提交于 2019-12-13 19:17:47

问题


I am working on automating screenshots capture for one of my apps.

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.

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.

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.

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 &

I am running Fedora 21 with an Nvidia GPU.

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.


回答1:


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



来源:https://stackoverflow.com/questions/28373445/running-android-5-0-1-x86-virtual-device-with-host-gpu-disabled

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!