I'm trying to figure out how (or if it's possible) to accept the 'Force Close' dialog via the adb shell when an Android app crashes with a hard error (specifically out_of_memory). I'm hoping to basically loop an app with a bash script, so when it crashes I want to start it running again. The missing step here is that I can't simulate pressing the 'Force Close' button that shows up in the middle of the dialog.
At the same time, the process doesn't seem to actually be running (trying to kill the PID doesn't work), so it's a bit of a weird situation because it seems to have already stopped, but launching it again (via adb shell am ...) just gives me 'current task has been brought to the front'.
Any thoughts would be appreciated!
解决方案
However to kill the process you should use
am force-stop: force stop everything associated with .
am kill: Kill all processes associated with . Only kills.
processes that are safe to kill -- that is, will not impact the user
experience.
for example:
adb shell am force-stop