Android Emulator crashes with SIGSEGV on Ubuntu 18.04

After days of struggle I finally got it to work. The problem for me was that even if the OS was reporting Nvidia drivers as installed that was not the case. Checking with "lshw -c video" was showing that "nouveau" was in use regardless of how I was installing Nvidia ones - command line or using "Software & Updates" GUI.

What I've done was:

  • install Ubuntu 18.04 without the option to install 3rd party software for graphics
  • disable secure boot from BIOS. This was a key part which was preventing Nvidia drivers from being installed
  • install drivers from command line with "sudo apt install nvidia-driver-390"

Another (easy) way to fix this is to follow the driver installation instructions given here: https://askubuntu.com/a/1033498

i.e.

$ ubuntu-drivers devices
$ sudo ubuntu-drivers autoinstall

Then reboot, and use:

$ nvidia-smi

To confirm the drivers installed correctly, where the output should be something like:

Sun Feb 17 16:28:49 2019       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 390.77                 Driver Version: 390.77                    |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  Quadro P400         Off  | 00000000:09:00.0  On |                  N/A |
| 34%   26C    P0    N/A /  N/A |    199MiB /  1997MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0      1107      G   /usr/lib/xorg/Xorg                            96MiB |
|    0      2646      G   ...or/qemu/linux-x86_64/qemu-system-x86_64    99MiB |
+-----------------------------------------------------------------------------+