17

Problem with emulator in android studio 2...

Cannot launch AVD in emulator

Output:
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:  47
  Current serial number in output stream:  46
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:  47
  Current serial number in output stream:  46
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)
emulator: WARNING: VM heap size set below hardware specified minimum of 384MB
  Major opcode of failed request:  155 (GLX)
emulator: WARNING: Setting VM heap size to 384MB
  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

and this is in Console:

Error

and when running command for that answer it gives me bash: cd: /android-sdk-linux_x86/tools/lib64/libstdc++: No such file or directory

please guys help....

sushildlh
  • 8,986
  • 4
  • 33
  • 77

3 Answers3

32

Pick "Software" in the Emulated Performance Graphics option, in the AVD settings instead of "Automatic"

screenshot

Andrew
  • 36,676
  • 11
  • 141
  • 113
  • 1
    This for me overcame the issu `Emulator: libGL error: unable to load driver: nouveau_dri.so ...`, but when launching the emulator (Nexus_5X_API_27_x86), everything is black, even if I power up (I am a newbiew, so it may be a trivial issue). – sancho.s ReinstateMonicaCellio Nov 10 '17 at 20:11
26

Problem with the Sdk path.....

Linked the Sdk path instead of $ANDROID_HOME

  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++ 

In my case using path like that

 1. cd Desktop/blackgoogle/Android/Sdk/tools/lib64/libstdc++
 2. mv libstdc++.so.6 libstdc++.so.6.bak
 3. cd
 4. ln -s /usr/lib64/libstdc++.so.6 Desktop/blackgoogle/Android/Sdk/tools/lib64/libstdc++

Note:-pathOfSDK/tools/lib64/libstdc++

Possibly duplicate of Cannot start Emulator in android studio

Community
  • 1
  • 1
sushildlh
  • 8,986
  • 4
  • 33
  • 77
  • please elaborate what is happening there,how do i do that. – Vikas Pandey Dec 07 '16 at 06:51
  • @VikasPandey copy your sdk path and put in the SDKPAth/tools/libstdc++. Its moving some file from one folder to another and creating link of the file (like shortcut file ). – sushildlh Dec 07 '16 at 07:04
5

Use the below 3 commands to solve this error.

mv ~/Android/Sdk/tools/lib64/libstdc++/libstdc++.so.6{,.bak}
mv ~/Android/Sdk/tools/lib64/libstdc++/libstdc++.so.6.0.18{,.bak}
ln -s /usr/lib/libstdc++.so  ~/Android/Sdk/tools/lib64/libstdc++/
Kumar Ayush
  • 103
  • 1
  • 4
  • 2
    On Ubuntu 17.04, the paths were a bit different: `mv ~/Android/Sdk/emulator/lib64/libstdc++/libstdc++.so.6{,.bak}` and `mv ~/Android/Sdk/emulator/lib64/libstdc++/libstdc++.so.6.0.18{,.bak}` as well as `ln -s /usr/lib/gcc/x86_64-linux-gnu/6/libstdc++.so ~Android/Sdk/emulator/lib64/libstdc++/` – bovender Jul 05 '17 at 07:01
  • 3
    On ubuntu 17.10 the paths changed again: `mv ~/Android/Sdk/emulator/lib64/libstdc++/libstdc++.so.6{,.bak}` `mv ~/Android/Sdk/emulator/lib64/libstdc++/libstdc++.so.6.0.18{,‌​.bak}` `ln -s /usr/lib/gcc/x86_64-linux-gnu/7/libstdc++.so ~Android/Sdk/emulator/lib64/libstdc++/` – Andres de Lago Nov 02 '17 at 17:33
  • @Andres for copy and paster's the last line in Andres comment is missing a / between ~Android. Should be: ln -s /usr/lib/gcc/x86_64-linux-gnu/7/libstdc++.so ~/Android/Sdk/emulator/lib64/libstdc++ – user5389726598465 Jan 19 '18 at 15:07