我需要通过shell命令启动Genymotion,请问是否有可能做到这一点?
我需要通过shell命令启动Genymotion,请问是否有可能做到这一点?
Genymotion提供了一个名为Genymotion Shell的Shell。但是目前还不能使用它来启动虚拟机。
不过,您可以通过以下命令启动Genymotion虚拟机:
player --vm-name <VM id | VM name>
此命令将启动Genymotion播放器,让您可以访问所有Genymotion增强小部件(GPS、电池、旋转等)、屏幕缩放、渲染等功能,就像标准图形用户界面一样。
如果您想在没有增强功能的情况下使用Genymotion虚拟机,则可以通过VirtualBox命令行启动它,如下所示:
VBoxManage startvm gui <VM id | VM name>
您可以使用以下命令找到VM id:
VBoxManage list vms
它会以这种格式显示您的VirtualBox机器列表:name {id}
。
更新
从Genymotion 2.5.0开始,您可以使用命令行工具管理所有Genymotion设备。使用此工具,您可以创建、启动、停止、删除、推送文件、刷写设备等操作...以下是一个简单的示例,用于创建并启动设备:
gmtool admin create "Google Nexus 5 - 4.4.4 - API 19 - 1080x1920" myNexus
gmtool admin start myNexus
此功能仅适用于付费许可证。
针对Windows系统。
运行以下命令获取可用虚拟设备列表:
<Genymotion installer path>\genyshell -c "devices list"
运行以下命令之一来启动虚拟设备:
<Genymotion installer path>\player --vm-name "<virtual device name>"
2019年5月8日更新: 我已经为基于bash的genymotion cli创建了一个简单的包装器。链接到Github 在这里。
player -n $NAME -x
- gavenkoaplayer
可执行文件移动为player.app
。# First, get a list of the VM's you have installed
VBoxManage list vms
# Returns something like "5.0.0 - API 21 - 768x1280" {091d022d-6a7b-4475-845f-7a6e06024fb6}
复制虚拟机ID,例如091d022d-6a7b-4475-845f-7a6e06024fb6
,然后像这样再次使用:
# Launch a specific VM
open -a /Applications/Genymotion.app/Contents/MacOS/player.app --args --vm-name '091d022d-6a7b-4475-845f-7a6e06024fb6'
除了@eyal-lezmy的答案之外,这是我在当前的Genymotion 3.2.1中所做的:
gmtool admin list
输出示例
State | ADB Serial | UUID | Name
----------+-----------------+------------------------------------+---------------
Off | 0.0.0.0 |6aa30cf2-217a-4a27-9d29-13e41a351bd7| Google Pixel 3
Off | 0.0.0.0 |8ab62c9c-ef26-4a6b-870c-8db4fa54ed76| Samsung Galaxy S9
player -n 8ab62c9c-ef26-4a6b-870c-8db4fa54ed76
可以在Genymotion Shell文档中找到查找二进制文件位置的说明。