Search code examples
monkeyrunner

How to get application error with MonkeyRunner?


The "Force close" or "ANR" pop up when MonkeyRunner is running. How MonkeyRunner get the "Force close" or "ANR" error and stop script. Thank you very much.


Solution

  • If you have monekyrunner open you need to use ctrl+d to stop it. If you are using a script then you need to use sys.exit(1). (you'll need to import sys)

    To see if you got a force close you will need to use subprocess to make a subprocess to monitor the log for force closes.