我已经在 Ubuntu 16.04 的 vagrant box 中使用 apache cordova 准备了一个 Android 开发环境,主要遵循本指南,除了使用最新的 android sdk 工具(sdkmanager
& avdmanager
)。
我通过在 Vagrantfile 中添加以下内容启用了 ssh X11 转发:
config.ssh.forward_agent = true
config.ssh.forward_x11 = true
但是当我尝试使用 运行 Android 模拟器时cordova emulate android
,会打开一个新窗口一段时间,但随后它会卡住(停止加载),并且我收到以下 X11 错误:
No emulator specified, defaulting to Android-27
Waiting for emulator to start...
emulator: Requested console port 5584: Inferring adb port 5585.
emulator: WARNING: encryption is off
pulseaudio: pa_context_connect() failed
pulseaudio: Reason: Connection refused
pulseaudio: Failed to initialize PA contextaudio: Could not init `pa' audio driver
X Error of failed request: BadRequest (invalid request code or no such operation)
Major opcode of failed request: 130 (MIT-SHM)
Minor opcode of failed request: 1 (X_ShmAttach)
Serial number of failed request: 14
Current serial number in output stream: 15
有什么办法可以解决这个问题吗?我寻找了它的存在,/var/log/<Xorg.log>
但没有找到。
编辑:我journalctl -f
在另一个窗口中运行,在崩溃之前,它记录了这些内容:
Dec 13 17:20:35 cordova pulseaudio[2702]: [pulseaudio] server-lookup.c: Unable to contact D-Bus: org.freedesktop.DBus.Error.Spawn.ExecFailed: /usr/bin/dbus-launch terminated abnormally without any error message
Dec 13 17:20:35 cordova pulseaudio[2702]: [pulseaudio] main.c: Unable to contact D-Bus: org.freedesktop.DBus.Error.Spawn.ExecFailed: /usr/bin/dbus-launch terminated abnormally without any error message