Android Virtual Device does not start in Android Studio 3.1 Canary 7

Event Log: Emulator: libGL error: unable to load driver: i965_dri.so

A Google search found that this is a known error:

More investigations found this:

https://ubuverse.com/android-emulator-does-not-launch-in-ubuntu-16-10/

From the above I did this:

$ cd ~/Android/Sdk/emulator/lib64/libstdc++ 
$ mv libstdc++.so.6 libstdc++.so.6.bak 
$ ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 libstdc++.so.6

*********************************************************

The above worked and the emulator started normally!

NOTE: you may have to repeat these 3 lines above after a reboot!

*********************************************************

Just previously I also did the below – so I’m not sure if it made the above work, or it would have worked anyway:

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

and also:

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

I also did:

cd ~/Android/Sdk/emulator/lib64/

$ cp -R libstdc++/ lib/

(lib was created in ~/Android/Sdk/emulator/lib64/ as a result of the above command)

e.g.

copy an entire directory, its subdirectories, and files:

cp -R dirtocopy/ newdir/

 

IMPORTANT: When I did the upgrade to Android Studio 3.2 Canary 2, it detected the new lib directory (see above) and the libstdc++.so.6.bak file created by the commands at the top of this post. It did an automatic work around and all seems to be working fine, but for future reference – you might want to delete this new lib directory and contents and the .bak file.

Leave a Reply