Cannot start Emulator in android studio 2.0

Android

Android Problem Overview


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?

Android Solutions


Solution 1 - Android

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

Solution 2 - Android

Another solution for me was to use systems libraries:

emulator -use-system-libs -avd YOUR_VIRTUAL_DEVICE_NAME

Solution 3 - Android

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

Solution 4 - Android

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

$ sudo apt-get install mesa-utils

Solution 5 - Android

$ 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

Solution 6 - Android

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
    

Solution 7 - Android

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

Solution 8 - Android

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.

Solution 9 - Android

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!

Solution 10 - Android

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

Solution 11 - Android

sudo apt-get install mesa-utils

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

Solution 12 - Android

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

Solution 13 - Android

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.

Solution 14 - Android

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

enter image description here

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSuraj PalweView Question on Stackoverflow
Solution 1 - AndroidGiorgio GhiatisView Answer on Stackoverflow
Solution 2 - AndroidLogainView Answer on Stackoverflow
Solution 3 - AndroidCode-ApprenticeView Answer on Stackoverflow
Solution 4 - AndroidikolimView Answer on Stackoverflow
Solution 5 - AndroidMortada JafarView Answer on Stackoverflow
Solution 6 - AndroidGaelView Answer on Stackoverflow
Solution 7 - AndroidlellomanView Answer on Stackoverflow
Solution 8 - AndroidefkanView Answer on Stackoverflow
Solution 9 - AndroidBeatrice LinView Answer on Stackoverflow
Solution 10 - Androiduser7470438View Answer on Stackoverflow
Solution 11 - AndroidSalma GomaaView Answer on Stackoverflow
Solution 12 - AndroidAkshar PatelView Answer on Stackoverflow
Solution 13 - AndroidGabriel QuintanaView Answer on Stackoverflow
Solution 14 - AndroidJSON C11View Answer on Stackoverflow