So I have an idea of testing my android app on my laptop using one avd but with multiple config.ini files to change the makeup of the avd itself.
I have created multiple avds, and copied the config.ini files into a separate folder.
I have also written a bash script to
- loop through my config.ini files
- copy them one at a time to the avd folder (overwriting the last one)
- attempt to stop any current running emulator (this is my big problem)
- start the emulator
- run my tests on it (which take screenshots)
- adb pull the screenshots off into a folder
- start again with the next ini file
So I have most of this working, but I can't for the life of me stop/start/restart the avd.
I've tried multiple things from various SO questions including, but not limited to
- adb emu kill
- telnet kill
- adb shell stop
- pgrep emulator -f (to find the pid) then kill -9 to stop it
nothing seems to work properly, regularly without either locking my script, or leaving some remnant files meaning I can't start the emulator again.
This seems like it should be so easy and a great way to run my app on multiple device emulators without having to have them all running at once, something which my laptop would never be able to handle (it could do maybe 3 at once)