ubuntu 上启动 Android Studio 模拟器 AVD 失败

文章目录
    • Android Studio 2.3.2
    • Ubuntu 16.10

    在 Android Studio 中点击 AVD Manager 启动指定的模拟器,发现毫无反应,也没有报错信息。

    为了看到报错信息,决定在命令行中启动模拟器

    which emulator
    /home/zhongwei/Android/Sdk/tools/emulator
    

    注意:如果不在 Android/Sdk/tools 目录下执行,会报错

    $ emulator -avd Nexus_5X_API_24  -netspeed full -netdelay none
    [140289984714560]:ERROR:./android/qt/qt_setup.cpp:28:Qt library not found at ../emulator
    /lib64/qt/lib
    Could not launch '../emulator/qemu/linux-x86_64/qemu-system-i386': Not a directory
    

    进入 Android/Sdk/tools 目录,执行,依然报错

    emulator -avd Nexus_5X_API_24  -netspeed full -netdelay none
    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:  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:  39
      Current serial number in output stream:  40
    QObject::~QObject: Timers cannot be stopped from another thread
    

    添加参数后,即可成功启动

    emulator -avd Nexus_5X_API_24  -netspeed full -netdelay none -use-system-libs
    

    关于作者 🌱

    我是来自山东烟台的一名开发者,有感兴趣的话题,或者软件开发需求,欢迎加微信 zhongwei 聊聊,或者关注我的个人公众号“大象工具”, 查看更多联系方式