Android 模拟器 - 无法加载驱动程序

Android emulator - unable to load driver

运行 Ubuntu,我收到此错误:

Cannot launch AVD in emulator.
Output:
libGL error: unable to load driver: i965_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: i965
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:  55
  Current serial number in output stream:  54

平台工具是最新的。

模拟器图像使用 https://dl.google.com/android/repository/sys-img/google_apis/x86_64-24_r08.zip 并且它在 Android N.

更新(2016 年 12 月 2 日): @Sébastien 的解决方案不再有效但提供:

Cannot launch AVD in emulator.
Output:
failed to create drawable
getGLES2ExtensionString: Could not create GLES 2.x Pbuffer!
Failed to obtain GLES 2.x extensions string!
Could not initialize emulated framebuffer
emulator: Listening for console connections on port: 5554
emulator: Serial number of this emulator (for ADB): emulator-5554
emulator: ERROR: Could not initialize OpenglES emulation, use '-gpu off' to disable it.
emulator: WARNING: ./android/metrics/metrics_reporter.cpp:142: Failed to get a writable, unused path for metrics. Tried: /home/me/.android/avd/metrics/metrics.17386.yogibear

如果我禁用基于 GPU 的渲染并切换到基于软件的 GL 图形,则会出现此运行时错误:

Firebase API initialization failure.
               DeadSystemException: The system died; earlier logs will point to the root cause
FATAL EXCEPTION: main
                  Process: com.whatever.mobile, PID: 4501
                  DeadSystemException: The system died; earlier logs will point to the root cause

我刚刚遇到同样的错误,简单地删除 $ANDROID_HOME/tools/lib64/libstdc++/* 对我有用。 16.10 (6.0.22) 附带的 libstdc++ 版本大于 sdk 工具 (6.0.18) 附带的版本,我想它会与其他库产生冲突。

有同样的问题,我的解决方法是设置以下环境变量:

export ANDROID_EMULATOR_USE_SYSTEM_LIBS=1

在我的例子中,我把它放在 ~/.bashrc 中。 发送后,我像往常一样启动模拟器,即从命令行:

$ emulator -avd Nexus_4_API_23

看起来这是 Android 错误跟踪器中跟踪的一个常见的众所周知的问题:https://code.google.com/p/android/issues/detail?id=197254

问题与llibstdc++.so.6有关进入AndroidSDK,可以通过以下命令解决:

cd ~/...../sdk/tools/lib64/libstdc++
mv libstdc++.so.6 libstdc++.so.6_OLD
ln -sf /usr/lib/x86_64-linux-gnu/libstdc++.so.6 libstdc++.so.6

来源:https://code.google.com/p/android/issues/detail?id=197254#c43

我一直在纠结这个问题,答案是正确的,只是我花了一些时间才弄明白的应用方法:

(作为根用户)我有 运行 : locate libstdc++.so.6

然后用当前库WITH VERSION和LOCATION的结果列表 我在 Android SDK 附带的应用程序上应用了 mv/rm(在我的例子中是 ~/Android/Sdk/emulator/lib/libstdc++/libstdc++.so.6),然后从系统的(/usr/lib/i386-linux-gnu/libstdc++.so.6 OR /usr/lib/x86_64-linux-gnu/libstdc++.so.6 OR /usr/lib32/libstdc++.so.6 取决于你的系统)