Android emulator (AVD) crashes on Wayland + NVIDIA (GBM) - android-studio

Update: The problem does not occur with the NVIDIA driver version 510 anymore.
I am running Android Studio 2020.3.1 on Wayland and I'm using the proprietary NVIDIA driver version 495, which allows me to use the the regular GBM implementation of Wayland instead of the especially tailored EGL version.
My problem is, that every time I try to start an Android emulator (AVD) via the AVD Manager, I get the following message after a few seconds:
The emulator process for AVD Pixel_2_API_30 has terminated.
Starting the AVD from the command-line shows that a segmentation fault occurred:
INFO | Android emulator version 31.1.4.0 (build_id 7920983) (CL:N/A)
WARNING | unexpected system image feature string, emulator might not function correctly, please try updating the emulator.
INFO | Info: Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway. ((null):0, (null))
Fontconfig warning: "/usr/share/fontconfig/conf.avail/05-reset-dirs-sample.conf", line 6: unknown element "reset-dirs"
WARNING | cannot add library /home/letorbi/Android/Sdk/emulator/qemu/linux-x86_64/lib64/vulkan/libvulkan.so: failed
INFO | added library /home/letorbi/Android/Sdk/emulator/lib64/vulkan/libvulkan.so
Segmentation fault (core dumped)
How can I get more information and is there a workaround to prevent the segfault?
For what it's worth, Wayland EGL is able to start the emulator somehow, but I see nothing but a black screen on the device. X11 is working, but I'd like to stay on Wayland if it is possible.

I was able to work around the segmentation fault, by disabling the Vulkan support for AVDs. This can be easily achieved by adding the following line to the file ~/.android/advancedFeatures.ini:
Vulkan = off
I've got this hint from an answer in a related question. This answer also suggests to add GLDirectMem = on, but that line was not needed to solve my problem. However, some benchmarking revealed that it might improve the performance a little bit, so you might want to add that line as well.

Related

gpu found. vendor id 10de device if 0x174d checking for bad AMD Vulkan driver version

Android Emulator gives this error: Failed to start monitoring emulator-5554.
The problem could be using a video as background because if i don't use it, the emulator runs correctly. The strange thing is that the same project has no problems on my friends' computers. Maybe the problem is the GPU? (nvidia geforce mx130) It seems it's trying to look for an AMD gpu even if i don't have it...
Android Emulator closed because of an internal error:
gpu found. vendor id 8086 device id 0x174d
checking for bad AMD vulkan driver version...
amdvlk64.dll not found. Checking for amdvlk32...
amdvlk32.dll not found. No bad AMD Vulkan driver versions found.
checking for bad vulkan-1.dll version...
vulkan-1.dll version: 1.1.114.0
Not known bad vulkan-1.dll version; continue.

Emulator, android studio

When I try run app in Android Studio I get warning:
Emulator: warning: host doesn't support requested feature: CPUID.80000001H:ECX.abm [bit 5]
Does anyone know how to fix it?
I'm working on Linux Mint.
I played with (a pristine chroot of) Ubuntu 16.04 myself now. Without package grub-pc-bin installed, QEMU failed to boot the rescue image saying Could not read from CDROM (code 0004). After sudo apt-get install grub-pc-bin it booted fine. So I enforce use of platform i386-pc in the code now and produce an error if it's found missing.
I consider this ticket fixed. If you still run into issues, please make new tickets (with terminal output, Ubuntu version, and a screenshot of te QEMU window). Thanks!
more...
You can fix this by replacing your CPU to any, that support LZCNT feature. More detailed answer I posted here: Android Virtual Device ERROR on Android Studio

Nvidia Linux graphics debugger Qt platform plugin "xcb"

I have been trying to debug my OpenGL graphics application using Nvidia Linux graphics debugger, the debugger application starts and installs the debugger to the device (graphics) correctly, but when trying to Launch the application to debug it shows this message
This application failed to start because it could not find or load the Qt platform plugin "xcb" in "". Available platform plugins are:
eglfs, linuxfb, minimal, minimalegl, offscreen, xcb. Reinstalling the
application may fix this problem. Aborted (core dump)
The application starts fine as standalone but starting with Linux GD.
I have seen lot of posts relating to xcb but could not find any answer relating to starting application using Nvidia linux graphics debugger
nvidia drivers I am using 378
os-ubuntu 16.04
Nvidia liniux graphics debugger 2.0
Qt opengl context
I had the same issue, and solved it by changing the LD_LIBRARY_PATH to the Qt installation path (on the launch environment options)
LD_LIBRARY_PATH=<some_dir>/Qt/5.7/gcc_64/lib

Graphical artifacts in eclipse - Linux Mint - Eclipse Mars

I'm using the following configuration:
Linux Mint 17.3 Cinnamon 2.8.6
kernel 3.19.0-32-generic
amd radeon r5 m330
driver: xserver-xorg-video-ati v 1:7.3.0-1ubuntu3.1
Eclipse Version: Mars.1 Release (4.5.1)
Build id: 20150924-1200
When I scroll the page I obtain this graphical problem (you can see the code duplicated, I imagine is a refresh problem of the GPU):
How can I solve the problem? I also tried to used fglrx-updates v. 2:15.200, but i didn't solve anything
I also tried to use an external monitor (samsung screen 23" connected with an hdmi) instead of the laptop screen but the problem doesn't goes away.
That seems to be related to libgtk3 usage in Linux Mint which is somewhat incompatible with Eclipse.
I had the same problem and I cured it adding:
--launcher.GTK_version
2
in eclipse.ini before --launcher.appendVmargs.
Unfortunately that doesn't seem to be the whole story as I still have "strange" crashes, but might be JavaFX-related, so YMMV.

HAX kernel module is not installed - AMD processor

I've recently installed Android Studio and I'm trying to run a Hello World app to see that everything works as it should. Which it evidently doesn't. I've followed every step on the Android Developer site for setting up Android Studio, yet I get this error when I try to run my app:
emulator: ERROR: x86 emulation currently requires hardware acceleration!
Please ensure Intel HAXM is properly installed and usable.
CPU acceleration status: HAX kernel module is not installed!
I searched for a bit and realized that HAXM is for Intel processors, and I'm running an AMD processor. I tried installing the emulator Bluestacks as suggested in this thread but it didn't help at all. Has anyone got a clever solution to this problem?
You might as well uninstall HAXM, only works with Intel processors.
A lot of answers in this forum have pointed to using genymotion (https://www.genymotion.com/) with AMD processors
This is what you need to do to fix this issue:
1) Navigate to the following path:
C:\Users\Main\AppData\Local\Android\sdk\extras\intel\Hardware_Accelerated_Execution_Manager
2) Run intelhaxm-android.exe as an administrator.
3) Once the installation is complete, Run your project and you will be able to run android emulator on your machine.
Hope this helps.

Resources