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

让人想犯罪 __ 提交于 2019-12-10 18:31:42

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/37256905/android-not-responding-if-debugging-if-not-in-debug-app-works-normally

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!