Prevent ApplicationNotResponding during debugging Prevent ApplicationNotResponding during debugging android android

Prevent ApplicationNotResponding during debugging


Go to Settings -> Developer options and check Show all ANRs.

This will show an App Not Responding dialog for apps running in the background. You can click the Wait button in the dialog to prevent the system from killing your process. Note that the dialog is opened automatically for apps running in the foreground. For background apps, you have to enable this option.


No. This message is handled through the Android OS, not your application, and there is no way to hide it on the Emulator. If you don't want to see it and your BroadcastReceiver receives the call correctly, just doesn't run successful code, you can use a try-catch block, and instead of your application crashing, the catch will be handled, wherein you can make a Toast message or whatever you wish.


You may find this resource useful for your problem. Key points:

  • Use -w to make process wait until debugger is attached. This one actually helps to stop on breakpoints on onCreate()'s. Debug flag is cleared after you attach debugger. Next time app starts in a regular way.
  • Use --persistent to wait for debugger every time process starts.
  • Use adb shell am clear-debug-app your.app.package to undo --persistent