由于操作系统 Ubuntu 16.04 中缺少驱动程序,不允许我 运行 android studio 上的模拟器

Not allow me to run the emulator on android studio for lack of driver in the operating system Ubuntu 16.04

我在 ubuntu 16.04 中使用 android studio 2.0 并且不要让我 运行 模拟器 avd 因为显然它缺少驱动程序。我该如何解决这个问题?

这是在我 运行 模拟器

之后抛出的异常
Cannot launch AVD in emulator.

Output:
libGL error: unable to load driver: radeonsi_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: radeonsi
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: radeonsi_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: radeonsi
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: radeonsi_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: radeonsi
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: VM heap size set below hardware specified minimum of 128MB
emulator: WARNING: Setting VM heap size to 384MB

如有任何回复,我们将不胜感激!

我在 Xubuntu 16.04 上解决这个问题的方法是:

  • 检查我的显卡是什么:lspci | grep VGA
    • 答案:一些 NVidia 型号
  • 检查我当前使用的图形驱动程序:sudo lshw -C video | grep driver
    • 回答:Nouveau 默认,免费软件驱动
  • 已安装专有 NVidia 驱动程序:转到主搜索菜单(取决于您的 Unity、Gnome 或 Xfce)> 其他驱动程序> 从 "Nouveau" 切换到“NVIDIA 二进制驱动程序 - 版本 3XX(专有,已测试) )
  • 重启

我的 Android 模拟器错误消失了:)

我也在使用 Android Studio 2.1 和 Ubuntu 16.04

个问题的答案非常有效。

有几点需要注意:我的 $ANDROID_HOME 与这个不同。我不得不删除文件名中的 android-sdk-linux_x86 。还有多个版本的 libstdc++.so.6 libstdc++.so.6.0.18 和 libstdc++.so.6.0.21。我仍然使用 libstdc++.so.6,它运行良好

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

好吧,我找到了解决这个问题的方法。 我不知道 Android Studio 有什么问题,但他无法执行任何模拟器,现在我的解决方案是通过命令执行模拟器,然后使用 android studio 安装模拟器执行下面的命令,因为你需要有模拟器,在我的例子中 Nexus_5_API_21.

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

我不记得我是在哪里找到这个解决方案的,但我认为它在 google 论坛上