Android studio buggy after upgrade to 16.10

I recently upgraded from 16.04 LTS where my android studio was working fine to 16.10 but on trying to run my avd emulators, this is the error log i get back instead

Cannot launch AVD in emulator.
Output:
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
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 r

Solution 1:

In the recent android studio updates, google use a libstdc++ that is incompatible with the intel driver installed on the system

You first have to install the following packages if there not on the system lib64stdc++6 and mesa-utils

sudo apt-get install lib64stdc++6 mesa-utils

Then symlink the libraries to the android sdk tools path

## For the /Sdk/tools path

cd ~/Android/Sdk/tools/lib64/libstdc++
# making a copy of the file
sudo mv libstdc++.so.6 libstdc++.so.6.og
# symlink
sudo ln -s /usr/lib64/libstdc++.so.6 ~/Android/Sdk/tools/lib64/libstdc++

## For the /Sdk/emulator path

cd ~/Android/Sdk/emulator/lib64/libstdc++
# making a copy of the file
sudo mv libstdc++.so.6 libstdc++.so.6.og 
# symlink
sudo ln -s /usr/lib64/libstdc++.so.6 ~/Android/Sdk/emulator/lib64/libstdc++

Solution 2:

I had also this problem on Ubuntu 17.04 and here's what I did.

Edit your .profile using your favorite text editor

atom ~/.profile

Append this at the end of the file

export ANDROID_EMULATOR_USE_SYSTEM_LIBS=1

Source: Android SDK Environment Variable