You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Android模拟器启动失败求助(Wayland/Hyprland环境)

Android模拟器在Wayland/Hyprland环境启动失败(Qt平台插件缺失)

在Wayland/Hyprland环境下执行以下命令启动Android模拟器时失败:

/home/Miguer/Android/Sdk/emulator/emulator @Device_Test

报错信息

INFO    | Android emulator version 32.1.11.0 (build_id 9536276) (CL:N/A)
INFO    | Found systemPath /home/Miguer/Android/Sdk/system-images/android-33/google_apis_playstore/x86_64/
INFO    | Storing crashdata in: /tmp/android-Miguer/emu-crash.db, detection is enabled
INFO    | Duplicate loglines will be removed, if you wish to see each indiviudal line launch with the -log-nofilter flag.
WARNING | Failed to process .ini file /home/Miguer/.android/avd/Device_Test.avd/quickbootChoice.ini for reading.
INFO    | Warning: Could not find the Qt platform plugin "wayland" in "/home/Miguer/Android/Sdk/emulator/lib64/qt/plugins" ((null):0, (null))
Fatal: This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: xcb.
 ((null):0, (null))
INFO    | Fatal: This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: xcb.
 ((null):0, (null))
[70842:70842:20230610,165240.588572:ERROR elf_dynamic_array_reader.h:64] tag not found
[1]    70834 IOT instruction (core dumped)  /home/Miguer/Android/Sdk/emulator/emulator @Device_Test

已尝试的操作:

  • 安装qt5-wayland:sudo pacman -S qt5-wayland
  • 重新安装Android Studio

解决方案

方法1:强制模拟器使用xcb平台运行

直接在启动命令前添加环境变量,强制Qt使用xcb插件:

QT_QPA_PLATFORM=xcb /home/Miguer/Android/Sdk/emulator/emulator @Device_Test

如果想永久生效,把环境变量加入你的shell配置文件(比如~/.bashrc、~/.zshrc)或者Hyprland的配置文件(~/.config/hyprland/hyprland.conf):

  • 对于shell配置文件,添加一行:
    export QT_QPA_PLATFORM=xcb
    
    执行source ~/.zshrc(对应你的shell)使配置立即生效。
  • 对于Hyprland配置文件,添加:
    env = QT_QPA_PLATFORM,xcb
    
    重启Hyprland即可。

方法2:复制系统Wayland插件到模拟器目录

  1. 先找到系统中qt5-wayland插件的位置:

    pacman -Ql qt5-wayland | grep wayland.*\.so
    

    通常输出路径类似/usr/lib/qt/plugins/platforms/libqwayland-egl.so和/usr/lib/qt/plugins/platforms/libqwayland-generic.so。

  2. 创建模拟器Qt插件的platforms目录(如果不存在):

    mkdir -p /home/Miguer/Android/Sdk/emulator/lib64/qt/plugins/platforms
    
  3. 复制插件到模拟器目录:

    sudo cp /usr/lib/qt/plugins/platforms/libqwayland*.so /home/Miguer/Android/Sdk/emulator/lib64/qt/plugins/platforms/
    
  4. 调整插件权限:

    sudo chmod 644 /home/Miguer/Android/Sdk/emulator/lib64/qt/plugins/platforms/libqwayland*.so
    

方法3:更新Android模拟器到最新版本

打开Android Studio的SDK Manager,找到Emulator组件,更新到最新版本。新版本的模拟器对Wayland环境的兼容性更好,可能直接解决插件缺失问题。


内容的提问来源于stack exchange,提问作者José Miguel

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.19 09:48:26