android 无法使用ssh服务器通过命令行启动模拟器

k4ymrczo  于 2023-05-27  发布在  Android
关注(0)|答案(1)|浏览(160)

所以,我有这个服务器,它被指定为自动化测试的设备。为了访问服务器,我大多数时候使用ssh,或者使用屏幕镜像来调试我的机器。我想从我的本地使用ssh在我的服务器上启动模拟器,但它失败了,显示以下错误:

user@msb-10-r2u32-2u4n-b:~$ emulator @PH_nightly_10

INFO    | Android emulator version 31.3.13.0 (build_id 9189900) (CL:N/A)emulator: INFO: Found systemPath /home/user/android_sdk/system-images/android-30/google_apis_playstore/x86_64/

INFO    | Duplicate loglines will be removed, if you wish to see each indiviudal line launch with the -log-nofilter flag.

WARNING | unexpected system image feature string, emulator might not function correctly, please try updating the emulator.

INFO    | Warning: could not connect to display  ((null):0, (null))

INFO    | Info: Could not load the Qt platform plugin "xcb" in "/home/user/android_sdk/emulator/lib64/qt/plugins" even though it was found. ((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))

但是,当我尝试使用屏幕镜像(noMachine)并从其终端编写相同的命令时,它成功启动了模拟器。
我试着用这个命令无头运行

$ emulator -no-window @EMULATOR_ID

它使用以下日志成功:

INFO    | Android emulator version 31.3.13.0 (build_id 9189900) (CL:N/A)

emulator: INFO: Found systemPath /home/bukalapak/android_sdk/system-images/android-30/google_apis_playstore/x86_64/

INFO    | Duplicate loglines will be removed, if you wish to see each indiviudal line launch with the -log-nofilter flag.

WARNING | unexpected system image feature string, emulator might not function correctly, please try updating the emulator.

WARNING | cannot add library /home/bukalapak/android_sdk/emulator/qemu/linux-x86_64/lib64/vulkan/libvulkan.so: failed

INFO    | added library /home/bukalapak/android_sdk/emulator/lib64/vulkan/libvulkan.so

INFO    | configAndStartRenderer: setting vsync to 60 hz

pulseaudio: Failed to initialize PA contextCould not init \`pa' audio driver

WARNING | \*\*\* No gRPC protection active, consider launching with the -grpc-use-jwt flag.\*\*\*

INFO    | Started GRPC server at 127.0.0.1:8554, security: Local, auth: none

INFO    | Advertising in: /run/user/1001/avd/running/pid_24535.ini

INFO    | setDisplayConfigs w 1080 h 2160 dpiX 440 dpiY 440

INFO    | Cold boot: incompatible snapshot version

INFO    | Your emulator is out of date, please update by launching Android Studio:

 - Start Android Studio

 - Select menu "Tools \> Android \> SDK Manager"

 - Click "SDK Tools" tab

 - Check "Android Emulator" checkbox

 - Click "OK"

INFO    | boot completed

INFO    | boot time 26691 ms

INFO    | Increasing screen off timeout, logcat buffer size to 2M.

INFO    | Revoking microphone permissions for Google App.
at0kjp5o

at0kjp5o1#

经过一天的折腾,我找到了一个适合我的方法。此外,我相信服务器机器必须有一个显示器插入这一工作。

export DISPLAY=:1

您的模拟器无法启动的主要原因是,当您使用ssh时,它没有显示器来启动它。使用-X标志运行ssh将在本地启动它。

相关问题