【问题标题】:how to kill a Genymotion VM via command prompt?如何通过命令提示符杀死 Genymotion VM?
【发布时间】:2015-05-14 09:34:03
【问题描述】:

命令

播放器--vm-name VM_NAME

用于启动 Genymotion VM 和

杀死 Genymotion VM 的命令是什么?

【问题讨论】:

  • 您为什么要这样做?只需按x
  • @jyoon 我想写一个脚本来测试android并想通过命令行自动启动和清除环境(杀死genymotion vm)
  • @jyoonPro 按 X 不起作用,因为该过程继续工作(MacOs)

标签: android shell avd genymotion


【解决方案1】:

您可以在*nix 系统上使用kill 命令,在Win 系统上使用taskkill

http://krazyrobot.com/2014/05/calabash-genymotion-and-jenkins/ 上有一篇关于在 Jenkins 设置中使用 Genymotion 的好文章。该命令的摘录如下:

PID=`ps | grep "Genymotion\.app/Contents/MacOS/player.*7b4f5185-b7d6-4151-9b09-9cefba4c0967.*" | awk '{print $1}'`
kill $PID

【讨论】:

  • 非常感谢,我会试试的
【解决方案2】:

简而言之,这个 oneliner 应该适用于 Mac OSX 上所有版本的 Genymotion:

ps x | grep "Genymotion\.app/Contents/MacOS/.*player" | awk '{print $1}' | xargs kill

以前版本的 Genymotion 播放器路径是:

Genymotion.app/Contents/MacOS/player

v2.6.0 的 Genymotion 播放器路径是:

Genymotion.app/Contents/MacOS/Player.app/Contents/MacOS/player

但是如果你像这样强行关闭它,有时如果你尝试恢复快照,你可能会因为VBOX_E_INVALID_VM_STATE

而失败
VBoxManage: error: Cannot delete the current state of the running machine (machine state: Running)
VBoxManage: error: Details: code VBOX_E_INVALID_VM_STATE (0x80bb0002), component SessionMachine, interface IMachine, callee nsISupports

解决方案 - 在杀死 Genymotion 播放器之前正常关闭 VM:

vboxmanage controlvm $YOUR_VM_NAME poweroff || true

【讨论】:

    【解决方案3】:

    如果你只是简单地使用 -x 运行相同的命令,它将关闭该框

    player --vm-name VM_NAME -x
    

    来自我设法在日志中找到的帮助

    [debug] Usage: player
    [debug]          --vm-name|-n <device name>
    [debug]          [ --no-popup|-s ]
    [debug]          [ --poweroff|-x  || 
    [debug]            --startadb|-a  || 
    [debug]            --stopadb|-z ]
    

    【讨论】:

      【解决方案4】:

      如果你想直接DISCARD VirtualBox Machine的状态,可以在终端输入:

      vboxmanage discardstate 'My Genymotion name machine'
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2016-06-22
        • 1970-01-01
        • 2011-08-09
        • 1970-01-01
        • 2011-06-01
        • 2018-10-25
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多