Solve Android Studio AVD issue with Ubuntu distros

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.

Android Studio AVD on Linux Ubuntu 16.10

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!

16 comments

  1. 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

  2. excuse me in my case doesn’t exist /Android/Sdk/emulator/lib64/ just exist /Android/Sdk/emulator/lib/ i should install it there?

  3. 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

Leave a Reply

Your email address will not be published. Required fields are marked *