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.
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).
Related
I want to connect an Intel Realsense camera (D455) to my android virtual device, running on the android emulator, so I can debug my android APP using the Realsense camera.
On this page, it seems that the latest android studio emulator supports USB passthrough, so I tried the following command:
./emulator -avd Nexus_6P_API_29 -qemu -usb -device usb-host,vendorid=0x8086,productid=0x0b5c
where -avd Nexus_6P_API_29 specifies the name of the android virtual device, and vendorid and productid are obtained by lsusb.
The emulator gives the following error message (showing it 3 times):
qemu-system-x86_64: Warning: speed mismatch trying to attach usb device "Intel(R) RealSense(TM) Depth Ca" ( speed) to bus "usb-bus.0", port "1" (full speed)
It seems the emulator does find the device, but there's a "speed mismatching" problem. I found a good explanation of the problem on this page, saying usb-bus corresponds to USB 1.0. As the Realsense camera supports usb-3.2, I think I should use usb-3.0, so I tried the following:
./emulator -avd Nexus_6P_API_29 -qemu -usb -device nec-usb-xhci,id=xhci -device usb-host,vendorid=0x8086,productid=0x0b5c
specifying nec-usb-xhci for usb-3.0.
However I'm getting the error message as:
qemu-system-x86_64: Warning: speed mismatch trying to attach usb device "Intel(R) RealSense(TM) Depth Ca" ( speed) to bus "xhci.0", port "1" (full+high+super speed)
I noted that, the speed of the camera is displayed as ( speed). (I.e. the actual speed, while normally should be one of (full speed)/(high speed)/(super speed), is blank.)
I guess the speed mismatch problem has something to do with this blank speed. Has anyone had similar experiences ? Thanks in advance !
Only EHCI is already built in the kernel on AVDs.
I've wrote on XDA a little guide with some deeper informations about it.
You can read more there.
If your device can handle EHCI, you could try it with:
-qemu -usb -device usb-ehci,id=ehci -device usb-host,bus=ehci.0,vendorid=0x8086,productid=0x0b5c
Otherwise, recompile your kernel with XHCI enabled.
Perhaps some other steps are necessary as well. Like adding permissions to android.hardware.usb.host
Update: 22.03.2021
I figured it is (was) a speed reporting issue from emulator qemu. Now with the Emulator Version 30.5.3 this issue is fixed and it works with all my UVC Standard cameras, on EHCI und XHCI. Also the built in Face Time Camera works as USB attached Device. But, only two Apps from the PlayStore were able to show me the footage. USB Camera - Connect EasyCap or USB WebCam very smooth and nice footage. UVC Camera / Usb Camera with driver from userspace with hugh jitter.
I am developing an app on Visual Studio with Xamarin. Yesterday emulator was working fine but it stopped to work suddenly without no reason.
Here is error message from vs console:
Starting emulator my_device ...
C:\Program Files (x86)\Android\android-sdk\emulator\emulator.EXE -partition-size 512 -no-boot-anim -avd my_device -prop monodroid.avdname=my_device
Failed to open /qemu.conf, err: 2
HAX is working and emulator runs in fast virt mode.
C:\Program Files (x86)\Android\android-sdk\emulator\qemu\windows-x86_64\qemu-system-i386.exe: error while loading state for instance 0x0 of device 'goldfish_pipe'
deleteSnapshot: for default_boot
emulator: INFO: QtLogger.cpp:68: Critical: UpdateLayeredWindowIndirect failed for ptDst=(1113, 122), size=(300x21), dirty=(300x21 0, 0) (Sisteme bağlı bir aygıt çalışmıyor.) ((null):0, (null))
Go to AVD manager
Try Wipe Data or Cold Boot Now options.
Most of the times, this error is caused when the system tries to draw something like app borders/edges etc and when it fails, it throws following error of UpdateLayeredWindowIndirect Failed
Therefore, it is highly related to graphics, so, try changing your Emulated Graphics in
AVD configuration --> Emulated Performance --> Graphics: Software
Please note that if you are using Google PlayStore API for Android SDK then you might not be able change this setting, therefore, if you are unable to change option of Graphics to Software, please create virtual device without PlayStore
Hi guys I am trying to get a basic emulator running to display Hello World but the emulator appears but the phone never switches on. Please help me.
D:\Installed_Softwares\AndroidSDK\tools\emulator.exe -netdelay none -netspeed full -avd Nexus_5_API_24_2
ERROR: resizing partition e2fsck failed with exit code 9
emulator: WARNING: userdata partition is resized from 513 M to 800 M
RegGetValueW failed 2 The system cannot find the file specified.
RegGetValueW failed 2 The system cannot find the file specified.
RegGetValueW failed 2 The system cannot find the file specified.
Hax is enabled
Hax ram_size 0x60000000
HAX is working and emulator runs in fast virt mode.
emulator: Listening for console connections on port: 5554
emulator: Serial number of this emulator (for ADB): emulator-5554
Will be glad to provide more information as needed.
If you are using Windows, you have to resize (downgrade) the RAM of your emulator uses.
Also, try to use an older version of the Android, like 4.2 or 4.4.
To solve the partition issue on Windows:
Install Cygwin and run the e2fsck cmd
# Navigate to AVD and change the API level of the folder
cd C:\Users\%USERNAME%\.android\avd\Nexus_5_API_16.avd
e2fsck -f userdata-qemu.img
emulator: device fd:668
HAX is working and emulator runs in fast virt mode
creating window 0 0 240 400
emulator: emulator window was out of view and was recentered
eglMakeCurrent failed
What is "eglMakeCurrent failed"?
TRIED
to set the window.x = 0 window.y = 0 ...
but window.x=322 keeps coming back... I tried changing the resolution....plus can't even move the emulator..tried ALT+SPACE and 'move'...but can't move it.. Although the emulator can be started –
In AVD Manager, change Boot option to Cold Boot. Then boot up the virtual device. After that you can change it back to Quick Boot. This usually happens if you modify something and the changes don't apply correctly.
Explicative Image(I hope)
In AVD Manager, change Emulated Performance - Graphics to Software - GLES 2.0
I ran into this after setting up multiple monitors using different graphics cards.
Please try:
adb kill-server
adb start-server
emulator -avd <avd_name> -no-snapshot-load
It works 100% if you have setup environment variable and PATH correctly.
I m trying to get a memory dump from a Android system using the pmemsave command from qemu, but I have some problems with accessing the qemu monitor interface.
I start the emulator with the following command:
$./emulator -avd test -verbose -qemu -monitor telnet:127.0.0.1:1234,server,nowait
The emulator starts up just fine, but when I telnet to the port I am not greeted with a banner, and no input seems to have any effect. I have also tried to set -monitor to stdio without success.
Same here. I'm afraid QEMU Monitor is no longer available.
Create AVD, telnet to it, and type qemu monitor:
$ telnet 127.0.0.1 5554
<snip>
qemu monitor
KO: QEMU support no longer available
See also:
Tweet https://twitter.com/blundell_apps/status/536163955186860032
Git commit https://github.com/android/platform_external_qemu/commit/aa1180ca05774398245953deb306c0e25829afee