我找到了一个从命令行启动模拟器的命令:
$ android-sdk-path/emulator/emulator -avd Nexus_5X_API_26 -netdelay none -netspeed full
但是我需要通过命令行检查模拟器是否已经运行,然后将其提到屏幕前方。这个能在命令行中实现吗?
$ android-sdk-path/emulator/emulator -avd Nexus_5X_API_26 -netdelay none -netspeed full
但是我需要通过命令行检查模拟器是否已经运行,然后将其提到屏幕前方。这个能在命令行中实现吗?
我找到了我的问题的答案:
创建一个名为showEmulator.scpt
的osscript文件。
tell application "System Events"
tell application process "Dock"
tell list 1
tell UI element "emulator"
perform action "AXPress"
end tell
end tell
end tell
end tell
然后在终端上执行以下命令:osascript ~/scripts/showEmulator.scpt
ps aux | grep -i emulator | grep -i Nexus_5X_API_26 | wc -l | read test | if [ "$test" != "0" ]; then; echo "yup"; fi;
- Ahmed Hegazy