Android LogCat 多次显示消息而不是一次
我正在开发一个连接到网络服务器并从中获取数据流的项目。出于测试目的,我在 LogCat
中显示所有数据,以便我可以确定一切都正确。
我正在 2 台设备上测试我的应用程序:
- HTC EVO 3D
- HTC DESIRE。
有一次,我注意到一些奇怪的事情:当我在 EVO 3D
上进行测试时,我发现我收到了所有数据流数据包两次,这真的很奇怪,因为服务器无法向我发送一个数据包两次。我认为这是因为 EVO 的双核处理器。
但之后我注意到 HTC Desire
和 emulator
也存在同样的问题。在模拟器上,我收到所有数据包甚至三次。
问题是这种情况并不总是发生。我仔细观察了这个问题,发现 LogCat 在我的设备和模拟器上显示了所有正在运行的进程两次或更多次,实际上我开始认为这是 LogCat 错误并且什么都没有与我的申请有关。
所以我的问题是:还有其他人遇到 LogCat 的同样奇怪的行为吗?这是 SDK 错误,还是问题出在我的应用程序代码中?
(我刚刚尝试了其他应用程序,结果是一样的)。
I'm working on a project which is connecting to web server and gets data stream from it. For testing purposes I'm showing all the data in LogCat
so I can be sure that everything is right.
I'm testing my application in 2 devices:
- HTC EVO 3D
- HTC DESIRE.
At one point I noticed something strange: when I'm testing on EVO 3D
I saw that I'm getting all packets of data stream twice, which is really strange because server cannot send me one packet two times. I thought it's because of EVO's
dual core processor.
But after that I noticed the same problem with HTC Desire
and in emulator
too. On emulator I'm getting all packets even three times.
The problem is that it's not always happening. I looked closer at that problem and I saw that LogCat
is showing all running processes on my devices and emulator twice or more and actually I started thinking that it's LogCat
bug and have nothing to do with my application.
So my question: is anybody else getting the same strange behaviour of LogCat? Is it an SDK bug, or the problem is in my application code?
(I just tried with other applications, and the result is the same).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如我所注意到的,这可能是某种
LogCat
bug,因为我调试了代码大约 50 次,发现没有任何东西可以重现该问题。我确实检查了我发送的对服务器的请求。这只是一个要求,没有更多。这就是为什么我开始认为这可能是一个LogCat
bug。As I noticed it's probably some kind of
LogCat
bug, because I debug my code maybe 50 times and find that there is nothing which can reproduce that problem. And I did check the request to the server which I am sending. It was only one request, not more. So that's why I started of thinking that it's probably anLogCat
bug.