I’ve made a bash script that runs on an VM using Ubuntu that starts like this:
nohup emulator @2.1 -snapshot 1 -no-snapshot-save &
echo ----------- Waiting for Device
adb wait-for-device
I then do some stuff and want to close/exit the emulator abandoning the changed state after the script is done. My problem is, that I don’t know how to exit the emulator – clean.
I thought about grabbing the emulators process ID and kill -9 it, but is there a ‘nicer’ way?
As far as I know adb, there is no way to stop the emulator gracefully. The docs say pressing Ctrl+C stops the emulator, therefore a kill -15 should work (and is ‘nicer’ than a kill -9).