Google+ Followers

Monday, 10 March 2014

launch and close genymotion emulator from command line (shell script)

  • Create a android emulator with some name ex: Nexus_5
  • launch emulator 
  • wait for device to be recognised
  • if device launch failed try again
#!/bin/bash
c=1
while [ $c -le 5 ]
do
    ps | grep "player" | awk '{print $1}' | xargs kill
    adb kill-server
    player --vm-name Nexus_5 &
    sleep 2
    adb start-server
    sleep 30
    res=`adb get-state`;echo $res
    if [ $res = "device" ]
    then
        break
    else
        echo "repeat simulator launch"
    fi
    c=$(($c+1))
done


To install genymotion check herehttp://www.mobiletestworld.com/2014/02/install-genymotion-fastest-android-emulator-on-mac.html


No comments:

Post a Comment