spaaarky21
spaaarky21

Reputation: 6858

Disable ANR messages while debugging

While debugging an application and stopped at a breakpoint, Android repeatedly displays "<Application> isn't responding. Do you want to close it?" dialogs with a "wait" and "ok" option. Is there any way to disable those while an application is being debugged?

Upvotes: 62

Views: 7457

Answers (4)

An ANR will be triggered for your app when one of the following conditions occur:

  • While your activity is in the foreground, your app has not responded to an input event or BroadcastReceiver (such as key press or screen touch events) within 5 seconds.
  • While you do not have an activity in the foreground, your BroadcastReceiver hasn't finished executing within a considerable amount of time.

I'm not sure what is your case here but when debugging just don't interact with the app (such as click button, tab on screen) and then the app will wait for the debugger.

Upvotes: -1

Perraco
Perraco

Reputation: 17340

In the Developer Options scroll down to the Debugging section and choose your app in "Select debugging app". This way it will not trigger any ANR when paused in a breakpoint. The setting value will be remembered even if you remove/reinstall your app.

Note that this option may not be available depending on your API level.

enter image description here

Upvotes: 39

Franklin
Franklin

Reputation: 27

When the app stops at the breakpoint

ANR is thought to have occurred by the system

But really you're just waiting for the break point

The system doesn't know that

dialog show by System

No need to pop anr when debug is not considered

I think unless you modify the system source code, Take that into account

I hope I can help you : )

Upvotes: -1

Dmytro Batyuk
Dmytro Batyuk

Reputation: 974

If your applications shows that message when is not staying on breakpoint there is definitely too much computation on the main thread and you should get rid of complex calculations on main thread and move them to background threads

Upvotes: -4

Related Questions