67

I just upgraded my android studio from 1.5 to 2.0.And now I am facing some weird bug when I try to start Emulator. I use Ubuntu 15.10 OS

Android monitor returns this message

sh: 1: glxinfo: not found
sh: 1: glxinfo: not found
libGL error: unable to load driver: r600_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: r600
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
 QObject::~QObject: Timers cannot be stopped from another thread

When I was using 1.5 version all was going good. Is it a bug in android studio 2.0.

How to remove this error?

Marcin Orlowski
  • 72,056
  • 11
  • 123
  • 141
Suraj Palwe
  • 2,080
  • 3
  • 26
  • 42

14 Answers14

196

Verify that you have installed in your system lib64stdc++6

With a 32 bits operating system :

# apt-get install lib64stdc++6

With a 64 bits operating system with multiarch enabled :

# apt-get install lib64stdc++6:i386

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

$ cd $ANDROID_HOME/android-sdk-linux_x86/tools/lib64/libstdc++
$ mv libstdc++.so.6 libstdc++.so.6.bak
$ ln -s /usr/lib64/libstdc++.so.6 $ANDROID_HOME/android-sdk-linux_x86/tools/lib64/libstdc++

EDIT: in 15.10 x64 with current Sdk (23), the folder is $ANDROID_HOME/Sdk

ItamarG3
  • 4,092
  • 6
  • 31
  • 44
Giorgio Ghiatis
  • 2,140
  • 1
  • 13
  • 10
  • 13
    UPVOTED! worked like a charm. NOTE FOR NEWBIES: `$ANDROID_HOME` is the path from your system's root to the folder where Android is contained in. for example: `\home\tony\Android` – tony gil Apr 25 '16 at 11:45
  • hey same problem with me and when i using `cd $ANDROID_HOME/android-sdk-linux_x86/tools/lib64/libstdc++` command its give me this `bash: cd: /android-sdk-linux_x86/tools/lib64/libstdc++: No such file or directory` please help. – sushildlh Jun 06 '16 at 08:50
  • @sushildlh you have to replace `$ANDROID_HOME` with your real android sdk installation path. Then the rest of the path should be as in the reply per default, otherwise change it accordingly to your. – Giorgio Ghiatis Jun 07 '16 at 08:07
  • 8
    For newer users of Android Studio my file path changed slightly in this case being `home/USERNAME/Android/Sdk/tools/lib64/libstdc++` – Gideon Sassoon Jun 08 '16 at 10:01
  • 4
    Works in Ubuntu 16.04 over ~/Android/Sdk/tools/lib64/libstdc++ – e-info128 Sep 05 '16 at 19:45
  • UPVOTED ! BTW for Android Source build nougat (JDK8) path is different apt-get install lib64stdc++6:i386 cd ~/ANDROID_HOME/prebuilts/android-emulator/linux-x86_64/lib64/libstdc++ mv libstdc++.so.6 libstdc++.so.6.bak ln -s /usr/lib64/libstdc++.so.6 ~/ANDROID_HOME/prebuilts/android-emulator/linux-x86_64/lib64/libstdc++ – Nikita Yo LAHOLA Nov 18 '16 at 23:35
  • 3
    This didn't work for me on Ubuntu 16.04. Doing a 'sudo apt install mesa-utils' was what fixed the issue for me (search this page for mesa-utils). – Gino Dec 13 '16 at 00:36
  • 7
    Just a workaround in my case the path was /home/Android/Sdk/emulator/lib/libstdc++ long live ubuntu – cammando Apr 17 '17 at 03:48
  • You saved me so much @cammando on Android Studio 3 I searched for $ANDROID_HOME/Sdk/tools/lib64 and could't see that folder. –  Nov 14 '17 at 07:29
  • While this worked many times, and still works, it can't be the only solution after so many years. Surely someone from Android Dev Team looked into this problem and tried to solve it, or is there reason why it is not solved yet, why it can't work out of the box ?? – clzola Apr 09 '18 at 18:08
  • 1
    works good. my path was: `~/Android/Sdk/emulator/lib64/libstdc++` – jan-seins May 04 '18 at 07:11
  • Find your path with `find $ANDROID_HOME -name "libstdc++"` – everyman Dec 18 '18 at 10:46
25

Another solution for me was to use systems libraries:

emulator -use-system-libs -avd YOUR_VIRTUAL_DEVICE_NAME

Logain
  • 4,259
  • 1
  • 23
  • 32
  • 1
    okay I havent tested this ans... but one suggestion when you ans which contains Some variable in the command.. Try using UPPERCASE letter. since it is good pratice to use.. thanks for your ans – Suraj Palwe Jul 25 '16 at 16:14
  • 1
    How can I launch emulator from UI with this option? I am too lazy to start emulator from terminal each time (: – aleien Sep 27 '16 at 09:13
  • You could make it into a gradle task that runs that command. And then you can run it from the Gradle tab or using Run Configuration on the top bar. – Logain Sep 28 '16 at 01:00
  • try to go yours way, but catch a mistake: `sh: 1: glxinfo: not found [139650585499456]:ERROR:./android/qt/qt_setup.cpp:28:Qt library not found at ../emulator/lib64/qt/lib Could not launch '../emulator/qemu/linux-x86_64/qemu-system-i386': No such file or directory ` – Morozov Aug 11 '17 at 14:07
  • Looks like you have some missing libraries. Try with the selected answer instead, or something like the answer in https://stackoverflow.com/questions/36258908/cannot-launch-avd-in-emulator-output-sh-1-glxinfo depending on your OS – Logain Aug 17 '17 at 17:13
22

I had the same issue on an Arch Linux box. I had to do two things to solve all the issues:

  1. Install mesa-demos. This is the Arch Linux package which contains glxinfo:

    $ sudo pacman -S mesa-demos
    
  2. Run the emulator with the -use-system-libs flag:

    $ emulator -avd <AVD name> -use-system-libs
    

    To enable this behavior in Android Studio, I set the ANDROID_EMULATOR_USE_SYSTEM_LIBS enviornment variable in ~/.zshrc.

    export ANDROID_EMULATOR_USE_SYSTEM_LIBS=1
    

    You can also set this in ~/.profile or ~/.bashrc. In all of these cases, you will have to start Android Studio from the command-line. Alternatively, you can set it in ~/.pam_environment to be able to start Android Studio from a desktop launcher:

    ANDROID_EMULATOR_USE_SYSTEM_LIBS=1
    
Code-Apprentice
  • 81,660
  • 23
  • 145
  • 268
  • This should be the best answer (supposing that the system lib required is installed) as you don't mess around with the software contents itself. – gbc921 Oct 10 '17 at 00:03
  • 1
    Yes. Note that you can lists your AVDs with `emulator -list-avds` – eis Jan 27 '18 at 14:08
16

After doing the two steps above (posted by Giorgio Ghiatis), install mesa-utils if it is not installed.

$ sudo apt-get install mesa-utils

ikolim
  • 15,721
  • 2
  • 19
  • 29
13
$ cd Android/Sdk/emulator/lib64/libstdc++
$ mv libstdc++.so.6 libstdc++.so.6.bak
$ ln -s /usr/lib64/libstdc++.so.6

it's worked for me

Mortada Jafar
  • 3,529
  • 1
  • 18
  • 33
9

Same problem for me on Ubuntu 16.04 LTS x64 with :

  • Android Studio 2.2.3
  • Android SDK Tools 25.2.4
  • Emulator version 25.2.4-3534729 (From Emulator > Extended Controls > Help > About)

My graphic card is an AMD/ATI Radeon and I read from this thread on Android Open Source Project - Issue Tracker that :

The root cause of the problem is likely that the Radeon GL driver library requires a more recent libstdc++.so than the one bundled with the emulator.

Here's how I fixed the problem :

  1. Install lib64stdc++6

    $ sudo apt-get install lib64stdc++6:i386   
    
  2. Install mesa-demos

    $ sudo apt-get install mesa-utils
    
  3. Move libstdc++.so.6 out of the way by renaming it to libstdc++.so.6.bak

    $ cd ~/$ANDROID_HOME/Android/Sdk/tools/lib64/libstdc++
    $ mv libstdc++.so.6 libstdc++.so.6.bak
    
Gael
  • 341
  • 3
  • 5
2

after the update to build tools 25.3.1 libstdc++.so.6 file had been moved to $ANDROID_HOME/Sdk/emulator/lib64/libstdc++/libstdc++.so.6

lelloman
  • 13,883
  • 5
  • 63
  • 85
1

In an extraordinary situation your KVM resources might be busy because of another running VirtualBox VMs.

(I've experienced this issue).

To overcome this issue I used Genymotion instead of Android Emulator.

Then I could run Genymotion together with other VirtualBox VMs.

efkan
  • 12,991
  • 6
  • 73
  • 106
1
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

Try it!

Beatrice Lin
  • 1,456
  • 14
  • 17
0

Fix on Ubuntu 16 LTS

1.Install lib64stdc++6

sudo apt-get install lib64stdc++6:i386  

2.Install mesa-demos

sudo apt-get install mesa-utils
0
sudo apt-get install mesa-utils

Ref: https://github.com/beidl/prime-indicator/issues/6

Tushar
  • 85,780
  • 21
  • 159
  • 179
Salma Gomaa
  • 952
  • 1
  • 13
  • 18
0

All of the above answers did not work for me as "Android Emulator" was not installed with standard installation of Android Studio. Make sure you have installed it and then try above answers. enter image description here

Akshar Patel
  • 8,998
  • 6
  • 35
  • 50
0

I had the same problem and the solution didn't work for me.

The solution that work for me was telling to Android Studio that use the system libraries instead of the built-in by editing $HOME/.profile and adding the next line: export ANDROID_EMULATOR_USE_SYSTEM_LIBS=1, and then re-log.

0

Create a new AVD, or edit an existing one and change the Emulated Performance Graphics from Automatic to Software

enter image description here

JSON C11
  • 11,272
  • 7
  • 78
  • 65