8

Emulator was not installed upon installing Android Studio. Here is the error when I call tools/android/avdmanager:

sh: 1: glxinfo: not found
sh: 1: glxinfo: not found
libGL error: unable to load driver: nouveau_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: nouveau
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  155 (GLX)
  Minor opcode of failed request:  24 (X_GLXCreateNewContext)
  Value in failed request:  0x0
  Serial number of failed request:  33
  Current serial number in output stream:  34

After a while, I am seeing a new error in a window popup

Cannot launch AVD in emulator.
Output:
libGL error: unable to load driver: nouveau_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: nouveau
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:  49
  Current serial number in output stream:  48
libGL error: unable to load driver: nouveau_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: nouveau
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:  49
  Current serial number in output stream:  48
1

7 Answers 7

14

I am using Android Studio 2.1.1 and Ubuntu 16.04 (x64). The following solved the problems (sh: 1: glxinfo: not found and libGL error:.) for me.

  1. $ sudo apt-get install lib64stdc++6 (if it is not installed)
  2. $ cd ~/Android/Sdk/tools/lib64/libstdc++
  3. $ mv libstdc++.so.6 libstdc++.so.6.original
  4. $ ln -s /usr/lib64/libstdc++.so.6 ~/Android/Sdk/tools/lib64/libstdc++
  5. $ sudo apt-get install mesa-utils (if it is not installed)
3
  • For me, I had to modify step #4 with the following: "ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 ~/Android/Sdk/tools/lib64/libstdc++" Then I was able to launch the AVD. But it still hangs. Trying to find a solution. Sep 20, 2016 at 20:22
  • In the end, what worked for me was to install nvidia drivers. See the complete solution at android.stackexchange.com/a/158125/188537 Sep 20, 2016 at 22:12
  • That worked for me on Ubuntu 16.04.1 with Android Studio 2.2.3, Thanks @kolim Dec 14, 2016 at 21:16
3

Install in your system lib64stdc++6

# sudo apt-get install lib64stdc++6

Then link the new installed libraries to the android sdk tools path

$ cd $ANDROID_HOME/Sdk/tools/lib64/libstdc++
$ mv libstdc++.so.6 libstdc++.so.6.bak
$ ln -s /usr/lib64/libstdc++.so.6 $ANDROID_HOME/Sdk/tools/lib64/libstdc++
$ $ANDROID_HOME/Sdk/tools/emulator -use-system-libs -avd YOUR_VIRTUAL_DEVICE_NAME

It helped me.

0

I add the same error, but solved it by choosing software acceleration (not the GPU HW).

Regards

0

I was also having a lot of problems to launch AVD on my machine. Struggled with using system libs, creating symlinks to local libraries, etc...

What really made it work for me was to install the nvidia drivers with

sudo apt install nvidia-340

My distro:

$ uname -a
Linux ruapehu 4.4.0-38-generic #57-Ubuntu SMP Tue Sep 6 15:42:33 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

$ cat /etc/issue
Ubuntu 16.04.1 LTS \n \l

Make sure you check the nvidia package suitable for you, as Ubuntu offers different flavors. For instance:

$ sudo apt list "*nvidia-[0-9][0-9][0-9]" 
Listing... Done
nvidia-304/xenial 304.131-0ubuntu3 amd64
nvidia-331/xenial 340.96-0ubuntu3 amd64
nvidia-340/xenial,now 340.96-0ubuntu3 amd64 [installed]
nvidia-346/xenial 352.63-0ubuntu3 amd64
nvidia-352/xenial 361.42-0ubuntu2 amd64
nvidia-361/xenial,now 361.42-0ubuntu2 amd64

I tested the list in a bottom-up strategy, from 361 until I found one that worked (340, in my case).

Hope that helps.

0

I hope this will solve your problem.
I had a freshly installed latest Android Studio and perform all basic steps to run a 'Hello World' project in emulator
but had a same problem while running emulator from avd manager.
After that i tried running emulator from command line also but faced same problem.
After long debugging i came to find out that it was missing some core library,
and then solved the problem by selecting checkbox and install emulator from Android Studio Options.

Tools -> Android -> SDK Manager -> SDK Tools -> Android Emulator

And click Apply and Run project again.
Now its working like a charm.Sample Screenshot

0

I am running ubuntu 16.04 LTS. Searching for additional drivers in Software and Updates and changing to NVIDIA binary driver - version 340.102 solved the problem with the AVD

0

I also have the same issue I resolved it by following these lines write in terminal.

sudo apt-get install lib64stdc++6
mv libstdc++.so.6 libstdc++.so.6.original
ln -s /usr/lib64/libstdc++.so.6 ~/Android/Sdk/emulator/lib64/libstdc++

and thats it....

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .