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

如何在Wayland环境下启动Android模拟器?

问题

在Android Studio外部使用emulator CLI工具,已通过avdmanager创建AVD。执行命令emulator -avd my_android_30_avd后,模拟器启动(从日志可确认是Google官方Android模拟器,而非Genymotion),但希望通过Wayland compositor启动,推测启动失败是因为以下报错:

Warning: Could not find the Qt platform plugin "wayland" in "/nix/store/h43v0qqmis2difm7kmnxsbr5ijxadjik-android-sdk-emulator-35.1.4/libexec/android-sdk/emulator/lib64/qt/plugins"

请问是否存在Android SDK的Wayland插件?能否通过Wayland启动我的模拟器?

模拟器启动日志

INFO    | Storing crashdata in: /tmp/android-billy/emu-crash-35.1.4.db, detection is enabled for process: 22525
INFO    | Android emulator version 35.1.4.0 (build_id 11672324) (CL:N/A)
INFO    | Found systemPath /nix/store/55nhl8lj7idnxappslddgzcykpgzr3wh-androidsdk/libexec/android-sdk/system-images/android-30/google_apis_playstore/x86_64/
INFO    | Storing crashdata in: /tmp/android-billy/emu-crash-35.1.4.db, detection is enabled for process: 22525
INFO    | Duplicate loglines will be removed, if you wish to see each individual line launch with the -log-nofilter flag.
WARNING | Please update the emulator to one that supports the feature(s): Vulkan
INFO    | Increasing RAM size to 2048MB
WARNING | File System is not ext4, disable QuickbootFileBacked feature
WARNING | FeatureControl is requesting a non existing feature.
INFO    | Warning: Could not find the Qt platform plugin "wayland" in "/nix/store/h43v0qqmis2difm7kmnxsbr5ijxadjik-android-sdk-emulator-35.1.4/libexec/android-sdk/emulator/lib64/qt/plugins" ((null):0, (null))
INFO    | Warning: QMetaObject::connectSlotsByName: No matching signal for on_new_posture_requested(int) ((null):0, (null))
INFO    | Warning: QMetaObject::connectSlotsByName: No matching signal for on_dismiss_posture_selection_dialog() ((null):0, (null))
INFO    | Warning: QMetaObject::connectSlotsByName: No matching signal for on_new_resizable_requested(PresetEmulatorSizeType) ((null):0, (null))
INFO    | Warning: QMetaObject::connectSlotsByName: No matching signal for on_dismiss_resizable_dialog() ((null):0, (null))
INFO    | Warning: QMetaObject::connectSlotsByName: No matching signal for on_sleep_timer_done() ((null):0, (null))
INFO    | Warning: QMetaObject::connectSlotsByName: No matching signal for on_unfold_timer_done() ((null):0, (null))
WARNING | Your GPU drivers may have a bug. Switching to software rendering.
library_mode swangle_indirect gpu mode swangle_indirect
INFO    | Initializing hardware OpenGLES emulation support
android_startOpenglesRenderer: gpu infoI0907 11:31:09.553583   22525 HealthMonitor.cpp:279] HealthMonitor disabled.
cannot add library /nix/store/h43v0qqmis2difm7kmnxsbr5ijxadjik-android-sdk-emulator-35.1.4/libexec/android-sdk/emulator/qemu/linux-x86_64/lib64/vulkan/libvulkan.so: failed
cannot add library /nix/store/h43v0qqmis2difm7kmnxsbr5ijxadjik-android-sdk-emulator-35.1.4/libexec/android-sdk/emulator/qemu/linux-x86_64/lib64/vulkan/libvulkan.so.1: failed
added library /nix/store/h43v0qqmis2difm7kmnxsbr5ijxadjik-android-sdk-emulator-35.1.4/libexec/android-sdk/emulator/lib64/vulkan/libvulkan.so
createGlobalVkEmulation:997 Selecting Vulkan device: SwiftShader Device (Subzero)
initialize: Supports id properties, got a vulkan device UUID
I0907 11:31:09.604375   22525 VkCommonOperations.cpp:1287] Initializing VkEmulation features:
I0907 11:31:09.604393   22525 VkCommonOperations.cpp:1288]     glInteropSupported: false
I0907 11:31:09.604396   22525 VkCommonOperations.cpp:1289]     useDeferredCommands: true
I0907 11:31:09.604399   22525 VkCommonOperations.cpp:1291]     createResourceWithRequirements: true
I0907 11:31:09.604401   22525 VkCommonOperations.cpp:1292]     useVulkanComposition: false
I0907 11:31:09.604403   22525 VkCommonOperations.cpp:1293]     useVulkanNativeSwapchain: false
I0907 11:31:09.604405   22525 VkCommonOperations.cpp:1294]     enable guestRenderDoc: false
I0907 11:31:09.604407   22525 VkCommonOperations.cpp:1295]     ASTC LDR emulation mode: 2
I0907 11:31:09.604409   22525 VkCommonOperations.cpp:1296]     enable ETC2 emulation: true
I0907 11:31:09.604412   22525 VkCommonOperations.cpp:1297]     enable Ycbcr emulation: false
I0907 11:31:09.604414   22525 VkCommonOperations.cpp:1298]     guestUsesAngle: false
I0907 11:31:09.604416   22525 VkCommonOperations.cpp:1299]     useDedicatedAllocations: false
I0907 11:31:09.604593   22525 FrameBuffer.cpp:505] Graphics Adapter Vendor Google (Google Inc.)
I0907 11:31:09.604596   22525 FrameBuffer.cpp:506] Graphics Adapter Android Emulator OpenGL ES Translator (Google SwiftShader)
I0907 11:31:09.604598   22525 FrameBuffer.cpp:507] Graphics API Version OpenGL ES 3.0 (OpenGL ES 3.0 SwiftShader 4.0.0.1)
I0907 11:31:09.604600   22525 FrameBuffer.cpp:508] Graphics API Extensions GL_OES_EGL_sync GL_OES_EGL_image GL_OES_EGL_image_external GL_OES_depth24 GL_OES_depth32 GL_OES_element_index_uint GL_OES_texture_float GL_OES_texture_float_linear GL_OES_compressed_paletted_texture GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth_texture GL_OES_texture_half_float GL_OES_texture_half_float_linear GL_OES_packed_depth_stencil GL_OES_vertex_half_float GL_OES_standard_derivatives GL_OES_texture_npot GL_OES_rgb8_rgba8 GL_EXT_color_buffer_float GL_EXT_color_buffer_half_float GL_EXT_texture_format_BGRA8888 GL_APPLE_texture_format_BGRA8888 
I0907 11:31:09.604604   22525 FrameBuffer.cpp:509] Graphics Device Extensions N/A
WARNING: cannot unmap ptr 0x7fff4d7ec000 as it is in the protected range from 0x7fff4d7ec000 to 0x7fffcd9ec000
WARNING: cannot unmap ptr 0x7fffcd801000 as it is in the protected range from 0x7fff4d7ec000 to 0x7fffcd9ec000
INFO    | Monitoring duration of emulator setup.
WARNING | The emulator now requires a signed jwt token for gRPC access! Use the -grpc flag if you really want an open unprotected grpc port
INFO    | Using security allow list from: /nix/store/h43v0qqmis2difm7kmnxsbr5ijxadjik-android-sdk-emulator-35.1.4/libexec/android-sdk/emulator/lib/emulator_access.json
WARNING | *** Basic token auth should only be used by android-studio ***
INFO    | The active JSON Web Key Sets can be found here: /run/user/1000/avd/running/22525/jwks/81641faa-bc69-4ff2-9918-112da4ba44ee/active.jwk
INFO    | Scanning /run/user/1000/avd/running/22525/jwks/81641faa-bc69-4ff2-9918-112da4ba44ee for jwk keys.
INFO    | Started GRPC server at 127.0.0.1:8554, security: Local, auth: +token
INFO    | Advertising in: /run/user/1000/avd/running/pid_22525.ini
I0907 11:31:09.678364   22575 FrameBuffer.cpp:2879] Setting display: 0 configuration to: 1080x1920, dpi: 420x420 
I0907 11:31:09.678383   22575 FrameBuffer.cpp:2892] setDisplayActiveConfig 0
INFO    | Loading snapshot 'default_boot'...
WARNING | Failed to process .ini file /home/billy/.android/emu-update-last-check.ini for reading.
WARNING | Device 'cache' does not have the requested snapshot 'default_boot'
WARNING | Failed to load snapshot 'default_boot'
WARNING | Failed to process .ini file /home/billy/.android/emu-update-last-check.ini for reading.
INFO    | Boot completed in 19123 ms
INFO    | Increasing screen off timeout, logcat buffer size to 2M.
解答

关于Wayland插件与启动可行性

  1. 官方Android模拟器默认不包含Wayland Qt插件
    你使用的Google官方Android模拟器,其打包的Qt库仅自带xcb(X11)平台插件,没有内置Wayland插件,这就是报错的直接原因。

  2. 可以通过Wayland启动模拟器,两种实现方式

    • 方式一:加载系统Qt的Wayland插件
      先找到系统中Qt Wayland插件的路径(比如NixOS中可能是/run/current-system/sw/lib/qt-*/plugins/platforms/),然后设置环境变量让模拟器加载该插件:

      export QT_QPA_PLATFORM=wayland
      export QT_PLUGIN_PATH=/path/to/system/qt/plugins:$QT_PLUGIN_PATH
      emulator -avd my_android_30_avd
      

      注意要保证系统Qt版本和模拟器依赖的Qt版本尽量接近,避免兼容性问题。

    • 方式二:使用XWayland兼容层
      如果不想配置插件,直接在Wayland环境下启动模拟器即可——它会自动通过XWayland运行,虽然不是原生Wayland,但能正常工作,你的日志里模拟器已经启动成功,说明默认走了这个路径。

额外注意事项

  • 你的模拟器版本(35.1.4)提示不支持Vulkan,建议升级到最新版本,新版本对Wayland兼容性更好,部分版本已原生支持Wayland(无需额外插件)。
  • 日志显示模拟器切换到了软件渲染模式,会影响性能,建议检查GPU驱动是否支持Vulkan或OpenGL,确保硬件加速正常工作。

内容的提问来源于stack exchange,提问作者mars8

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.18 15:09:52