Search code examples
androidmodal-dialogadb

Android Emulator, ADB command to clear 'Unforunately, MyApp has stopped running"?


I am automating some tasks for Unit Testing to the Android debugger. Unfortunately the app seems to crash and gives a wonderful system-level modal dialog with an OK box. I am hoping that I can, through the adb command line utility, send some sort of command to the emulator to virtually click the OK or otherwise dismiss the window so we can fire up the program again in the background. Anyone know how I might do this? Thanks in advance.


Solution

  • You can use input tap <x> <y> command to click on the Ok button.

    The input command has the following options in JB4.2:

    usage: input ...
       input text <string> [delay]
       input keyevent <key code number or name>
       input [touchscreen|touchpad] tap <x> <y>
       input [touchscreen|touchpad] swipe <x1> <y1> <x2> <y2>
       input trackball press
       input trackball roll <dx> <dy>