Cannot launch emulator on Linux (Ubuntu 15.10)

≡放荡痞女 提交于 2019-11-26 04:33:31

问题


I try to launch emulator but it outputs into log:

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:  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: 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:  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: 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 emulator: WARNING: Increasing RAM size to 1GB

How to fix it? I read topics with similar errors but it doesn\'t help me.


回答1:


Take a look at

https://code.google.com/p/android/issues/detail?id=197254

in particular items #3 and #19. This is a workaround rather than a true solution, but it got me moving again. You will have to adjust the command for:

  • the location of the libstdc++.so.6 file on your system - I used locate libstdc++.so.6 to find this
  • the path to the emulator executable
  • the name of your emulator

so my command was

LD_PRELOAD='/usr/lib/x86_64-linux-gnu/libstdc++.so.6' ~/Android/Sdk/tools/emulator -netdelay none -netspeed full -avd Nexus_5_API_21

This then launches the emulator, and you can select it in the 'Device Chooser' dialogue when you run your app.




回答2:


Using the libstdc++.so.6 that is available in your system instead of the one bundled with the android sdk solves this issue.

  • The emulator has a switch -use-system-libs to do this.

    ~/Android/Sdk/tools/emulator -avd Nexus_5_API_23 -use-system-libs

  • Alternatively you can set the ANDROID_EMULATOR_USE_SYSTEM_LIBS environment variable to 1 for your user/system. This has the benefit of making sure that the emulator will work even if you launched it from within Android Studio.

More details: https://code.google.com/p/android/issues/detail?id=197254#c15




回答3:


$ 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




回答4:


I have a similar error in Ubuntu 16.04 64-bit. For me the answer #23 solution works great https://code.google.com/p/android/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Status%20Priority%20Owner%20Summary%20Stars%20Reporter%20Opened&groupby=&sort=&id=197254

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



回答5:


Use "Software" in the Emulated Performance Graphics option, in the AVD settings. Very simple solution.




回答6:


i do this and it's working

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



回答7:


better locate your system default libstdc++.so.6 using the command locate libstdc++.so.6

And Then Take a back up of the android sdk version of the file in ~/Android/Sdk/tools/lib64/libstdc++/

And create a soft link for libstdc++.so.6 with the same name in the above path replacing the existing one pointing to the default file in the system

This way we do not need restart the emulator every time from command line.




回答8:


Try to change graphics option in Emulator settings:




回答9:


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 (note I'm not using Ubuntu 15.10):

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




回答10:


In my case (Ubuntu 16.10 64-bit, Android Studio 2.3) libs were located in another place. So commands are:

/home/myusername/Android/Sdk/emulator/lib64/libstdc++

➜  libstdc++ ll
total 9,3M
-rwxr-xr-x 1 myusername myusername 4,6M мар 21 00:09 libstdc++.so.6
-rwxr-xr-x 1 myusername myusername 4,6M мар 21 00:09 libstdc++.so.6.0.18

➜  libstdc++ mv libstdc++.so.6 libstdc++.so.6.bak
➜  libstdc++ mv libstdc++.so.6.0.18 libstdc++.so.6.0.18.bak
➜  libstdc++ ln -s /usr/lib32/libstdc++.so.6 /home/myusername/Android/Sdk/emulator/lib64/libstdc++ 
➜  libstdc++ ln -s /usr/lib32/libstdc++.so.6.0.22 /home/myusername/Android/Sdk/emulator/lib64/libstdc++ 

➜  libstdc++ ll
total 9,3M
lrwxrwxrwx 1 myusername myusername   25 мар 29 13:18 libstdc++.so.6 -> /usr/lib32/libstdc++.so.6
-rwxr-xr-x 1 myusername myusername 4,6M мар 21 00:09 libstdc++.so.6.0.18.bak
lrwxrwxrwx 1 myusername myusername   30 мар 29 13:19 libstdc++.so.6.0.22 -> /usr/lib32/libstdc++.so.6.0.22
-rwxr-xr-x 1 myusername myusername 4,6M мар 21 00:09 libstdc++.so.6.bak

And now emulator is launched from AVD manager normally.




回答11:


I had the similar problems with using i965_dri.so and swrast_dri.so, I wasn't able to change to software graphics in the GUI.

So I went to the emulator's folder (Show on Disk link in AVDM) and found the config.ini

Here I just changed the following line to stop it from using GPU:

hw.gpu.enabled=no



回答12:


This is fixed in Android Emulator 27.2.9. See the first fix listed here: https://developer.android.com/studio/releases/emulator#fixes




回答13:


$ 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



来源:https://stackoverflow.com/questions/35911302/cannot-launch-emulator-on-linux-ubuntu-15-10

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!