prevent ApplicationNotResponding在调试过程中 [英] Prevent ApplicationNotResponding during debugging

查看:173
本文介绍了prevent ApplicationNotResponding在调试过程中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很新的Andr​​oid和有一个调试的问题。我认识一个ANR是什么,并没有看到他们时,我跑我的应用程序正常运行。然而,当我尝试调试我BoradcastReceiver,我太慢了,并得到了ANR消息。

I am quite new to Android and have a debugging issue. I know what an ANR is for, and do not see them when I run my app normally. However, when I try to debug my BoradcastReceiver, I am too slow and get the ANR message.

有没有办法在调试会话关闭ANR?我可以使用日志语句,看看发生了什么,但是这很烦人......

Is there a way to switch off ANR during debug sessions? I could use log statement to see what's happening, but this is annoying....

编辑:其实,我也不想苏preSS在LogCat中的ANRS,我想告诉机器人不要在调试过程中抛出ANRS。我的意思是,让广播接收器需要更长的时间超过5秒运行。但我想这是不可能的,而是我应该委托给一个服务,该服务允许运行更长的时间,这点我也可以调试更加简单。

edit: actually, I don't want to supress the ANRs in the LogCat, I want to tell android not to throw ANRs during debugging. I mean to allow Broadcast receivers to take longer than 5 seconds to run. But I guess it will not be possible and instead I should delegate to a service, which is allowed to run longer, which I also can debug easier.

在此先感谢!

映入眼帘

推荐答案

进入设置 - >开发者选项,并选中显示所有ANRS。

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

这将显示在后台运行的应用程序的应用程序不响应对话框。您可以点击等待按钮,在对话框中以prevent系统杀死你的进程。需要注意的是自动打开在前台运行的应用程序的对话框。对于后台应用程序,您必须启用该选项。

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.

这篇关于prevent ApplicationNotResponding在调试过程中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆