How to repair corrupted/obsolote Genymotion emulator via shell

50 views Asked by At

I use a Genymotion android emulator for my automated Xamarin UI tests through the bash commands. The issue is that the emulator is killed by the test runner app after tests are done. So this causes some kind of corruption on the emulator's virtual device file, I suppose.

When I try to start the emulator next time using the same script, I get the following error from Genymotion:

enter image description here

After clicking the update button, Genymotion dashboard opens. Then I can run the emulator by double clicking. But, I cannot do these steps through the shell. If I could figure out what Genymotion does to repair the emulator, I would do the same thing in the shell script.

Here is my script to run the GM emulator;

 cd $HOME
 emulatorId=$(VBoxManage list vms | grep -E -o -i "([0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12})" | shuf -n 1)     
 open -a /Applications/Genymotion.app/Contents/MacOS/player.app --args --vm-name $emulatorId
 sleep 5
 adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done; input keyevent 82'

After this command is executed I run my tests like following;

dotnet test Droid.UI.test.dll

Any solution or workaround for skipping this prompt is highly appreciated, Thanks!

1

There are 1 answers

1
Julien On

Your script completely overrides the launchpad; that's the problem. Why not use gmtool? It has been designed especially for this type of use.