Problem
In the recent android studio update, google uses a libstdc++ that is incompatible with the intel driver installed on the system. This will cause an error like below:
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)
Solution
Install missing packages
You first have to install the following packages if they are not on your system.
lib64stdc++6
mesa-utils
Use below command to install these packages
sudo apt-get install lib64stdc++6 mesa-utils
Create symbol links
Then symlink the libraries to the android sdk lib64 path accordingly.
For the /<your-android-sdk>/tools path
cd ~/<your-android-sdk>/tools/lib64/libstdc++ # backup your file first sudo mv libstdc++.so.6 libstdc++.so.6.orig # symlink sudo ln -s /usr/lib64/libstdc++.so.6 ~/<your-android-sdk>/tools/lib64/libstdc++
For the /<your-android-sdk>/emulator path
cd ~/<your-android-sdk>/emulator/lib64/libstdc++ # backup your file first sudo mv libstdc++.so.6 libstdc++.so.6.orig # symlink sudo ln -s /usr/lib64/libstdc++.so.6 ~/<your-android-sdk>/emulator/lib64/libstdc++
Another possible solution
Add the missing CPU architecture that should be supported.
vim /etc/apt/sources.list
Add this line at the end of the sources list file:
deb http://httpredir.debian.org/debian/ jessie main contrib non-free
Then run below commands
apt-get update && apt-get upgrade -y sudo dpkg --add-architecture i386; sudo apt-get install libstdc++6:i386 -y
After these steps, then follow the “Create symbol links” section for subsequent actions.