Android Emulator Startup Issues

KVM Permission Issue

Error Dialog:

KVM Permission Issue

KVM is required to run this AVD
/dev/kvm device: permission denied.
Grant current user access to /dev/kvm

Do the following:

# Check whether the user is root and group is kvm
grep kvm /etc/group

# if user is root and group is kvm then skip this step
sudo apt install qemu-kvm

# Check again
grep kvm /etc/group 

# Add your current user to kvm group
sudo adduser $USER kvm

Lib Driver Error

If you get the following error while starting the emulator

libGL error: unable to load driver: i965_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: i965
libGL error: unable to load driver: i965_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: i965
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast
X Error of failed request:  GLXBadContext
  Major opcode of failed request:  155 (GLX)
  Minor opcode of failed request:  6 (X_GLXIsDirect)
  Serial number of failed request:  55
  Current serial number in output stream:  54

...

X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  155 (GLX)
  Minor opcode of failed request:  24 (X_GLXCreateNewContext)
  Value in failed request:  0x0
  Serial number of failed request:  39
  Current serial number in output stream:  40
QObject::~QObject: Timers cannot be stopped from another thread

then do the following steps:

# Go to your android sdk install directory /<<android-sdk-home>>/tools/lib64/libstdc++/
# e.g.
cd /apps/android-sdk/tools/lib64/libstdc++/

# rename libstdc++.so.6 to libstdc++.so.6.bkup
mv libstdc++.so.6 libstdc++.so.6.bkup