Felipe Andrade
Felipe Andrade

Reputation: 521

Android not responding if Debugging. If not in Debug app works normally

When I'm debugging and the app hits an breakpoint, I can debug normally for a while. Some time later, Android displays the ANR Dialog, but I still can debug normally.

If I don't click on the Phone's screen, it ends the debug, so I need to keep my eye on the screen when debugging and that's annoying and really wastes my time, because sometimes the dialog keeps popping every 10 seconds.

I don't know what is causing this. I tried restarting the Machine, Phone, ADB and already tried using debuggable="true" on AndroidManifest, with no success.

Upvotes: 4

Views: 2331

Answers (2)

Kevin Worth
Kevin Worth

Reputation: 805

For those stumbling upon this looking for a solution, the comment from @FedeH did it for me:

You can select your app as a debugging app under the developer options. This may help to reduce the unwanted system alerts.

Upvotes: 4

Felipe Andrade
Felipe Andrade

Reputation: 521

Looks like the problem is with a service running in background.

My service executes a background task every 5 minutes, so if the breakpoint "pauses" the main thread, the service tries to run and show the Not Responding popup. Ten seconds later, if we are still in the breakpoint, the system shows that annoying popup over and over again.

Just to be clear, there is no problem with my service, looks like it is the way IntelliJ IDEA debugs. When i need to debug something big, I disable the Service for the debug and the popup did not appear.

I don't know if there is a way to make the IDE aware that it is not responding because we are debugging the main Thread, cause that should be the right solution.

Upvotes: 2

Related Questions