我最近从 16.04 LTS 升级到了 16.10,我的 android studio 运行正常,但在尝试运行我的 avd 模拟器时,我得到的却是这样的错误日志
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: 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
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: 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 r
答案1
在最近的 Android Studio 更新中,谷歌使用了libstdc++
与系统上安装的英特尔驱动程序不兼容的
lib64stdc++6
如果系统上没有以下软件包,则必须先安装它们,
mesa-utils
sudo apt-get install lib64stdc++6 mesa-utils
然后将库符号链接到 android sdk 工具路径
## For the /Sdk/tools path
cd ~/Android/Sdk/tools/lib64/libstdc++
# making a copy of the file
sudo mv libstdc++.so.6 libstdc++.so.6.og
# symlink
sudo ln -s /usr/lib64/libstdc++.so.6 ~/Android/Sdk/tools/lib64/libstdc++
## For the /Sdk/emulator path
cd ~/Android/Sdk/emulator/lib64/libstdc++
# making a copy of the file
sudo mv libstdc++.so.6 libstdc++.so.6.og
# symlink
sudo ln -s /usr/lib64/libstdc++.so.6 ~/Android/Sdk/emulator/lib64/libstdc++
答案2
我在 Ubuntu 17.04 上也遇到了这个问题,以下是我所做的事情。
.profile
使用您喜欢的文本编辑器编辑
atom ~/.profile
将其附加到文件末尾
export ANDROID_EMULATOR_USE_SYSTEM_LIBS=1
答案3
从终端运行模拟器
emulator -use-system-libs -avd YOUR_VIRTUAL_DEVICE_NAME