1

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.

Laurent
  • 14,122
  • 13
  • 57
  • 89

1 Answers1

0

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

Laurent
  • 14,122
  • 13
  • 57
  • 89