Android LogCat displaying messages multiple times instead of once

人走茶凉 提交于 2019-12-13 12:49:42

问题


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).


回答1:


Try resetting ADB, as in this answer. It just worked for me.

Logcat showing information 3 times on AVD




回答2:


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 an LogCat bug.



来源:https://stackoverflow.com/questions/7594398/android-logcat-displaying-messages-multiple-times-instead-of-once

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