Android studio AVD issue with Ubuntu is really annoying because Android Studio environment has a lot of built-in parts and one of the most useful is Android Virtual Device Emulator.
Android Studio rants unable to load driver and AVD doesn’t start
Android Virtual Device Emulator helps you to test your applications in an easy way and without using a real device. The latest revision of Android Studio has also a very performant emulator system and you don’t feel the need of special Android emulator like Genymotion.
While using it on Fedora is a very charming experience, on different systems with Ubuntu 16.10, Ubuntu 17.04, Ubuntu 17.10 and Ubuntu 18.04 on board many issues came up.
Nothing painful, but if you get:
Cannot launch AVD in emulator.
Output:
libGL error: unable to load driver: i965_dri.so
libGL error: driver pointer missing
or something similar, you’re unable to work with the Android Emulator Device.
It’s a libGL error and libstdc++ issue. Cannot launch AVD emulators
It’s a known bug and you can easily beat it with some simple steps.
I have tested this solution on an Ubuntu 16.10 and Ubuntu 17.04 64bit
First, install some packages and libs:
$ sudo apt-get install lib64stdc++6:i386
$ sudo apt-get install mesa-utils
Second, tweak some links:
$ cd YOURPATH/Android/Sdk/tools/lib64
$ mv libstdc++/ libstdc++.bak
$ ln -s /usr/lib64/libstdc++.so.6 libstdc++
Sidenote: as many users have reported in the comments, in a recent version like Ubuntu 17.10/18.04 or in a different system like KDE Neon, the correct path is YOURPATH/Android/Sdk/emulator/lib64.
I have tested the following solution on an Ubuntu 17.10 and Ubuntu 18.04 64bit
So, the corrected and update instructions are:
$ cd YOURPATH/Android/Sdk/emulator/lib64
$ mv libstdc++/ libstdc++.bak
$ ln -s /usr/lib64/libstdc++.so.6 libstdc++
Third, relaunch your AVD device and test it.
If you experimented another issue, especially with Android Studio 3.1, on Ubuntu system like the new one Ubuntu 18.04 LTS, maybe you can also find useful the newer article How to solve Android Studio Emulator: libGL error on Ubuntu systems.
An alternative solution, available only by the terminal is to launch the emulator with:
$ emulator -use-system-libs -avd YOUR_VIRTUAL_DEVICE_NAME
That’s all. Enjoy it!
This works well , thanks a lot sir 🙂
You’re welcome!
Hi,
Thank you for help. However I can’t find YOURPATH/Android/Sdk/tools/lib64. However I find YOURPATH/Android/Sdk/emulator/lib64. But it still not work for me.
My problem may not be the same: I can see the progress bar “starting AVD” going to the end, but then nothing shows up. Thank you for any help
I’m sorry but you have a different issue. I suggest you to use Ask Ubuntu (https://askubuntu.com/) to find quickly support.
Thanks a lot sir!! It helped a lot!
Pleased to be helpful. 😉
Thank you so much, work well, KDE Neon 😀
My route was /Android/Sdk/emulator/lib64/
Thanks for sharing, it’s helpful for other distribution’s users.
excuse me in my case doesn’t exist /Android/Sdk/emulator/lib64/ just exist /Android/Sdk/emulator/lib/ i should install it there?
excuse me but in my case the directory doesn’t exist /Android/Sdk/tools/lib64 i did a search with the name of the files i found this
/home/keda12/Android/Sdk/emulator/lib/libstdc++
/home/keda12/Android/Sdk/emulator/lib/libstdc++/libstdc++.so.6
/home/keda12/Android/Sdk/emulator/lib/libstdc++/libstdc++.so.6.0.19
/home/keda12/Android/Sdk/emulator/lib64/libstdc++
/home/keda12/Android/Sdk/emulator/lib64/libstdc++/libstdc++.so.6
/home/keda12/Android/Sdk/emulator/lib64/libstdc++/libstdc++.so.6.0.19
sorry but i don’t speak english
Which Linux system? Which Android Studio version? As suggested by other comment, your route could be /Android/Sdk/emulator/lib64/
it works perfectly thanks Ubuntu 17.10 and Android Studio 3.0.1 and sorry the answer was under haha