Using LogCat on JellyBean

◇◆丶佛笑我妖孽 提交于 2019-12-21 09:29:52

问题


I have a bug that happens very randomly, so I rely on a LogCat monitoring app I bought off the Play Store, to see the exceptions thrown on my device when it happens. Since using Jelly Bean, I'm seeing no logging. I've read that, with Jelly Bean, an app can only see the LogCat output of itself.

So outside of rooting my device, is there any way to read the LogCat output of my app on my phone directly? I know I can use Eclipse, but, like I said, it happens so randomly and I can't manually recreate it.


回答1:


So outside of rooting my device, is there any way to read the LogCat output of my app on my phone directly?

Not really. You can read discussions on aLogcat bugtracker about this issue:

After doing some reading and some testing, I've found three ways to make aLogcat work, all of which use root.

More detailed discussion about READ_LOGS permission is not granted to 3rd party applications in Jelly Bean (api 16)




回答2:


What do you think about writing directly to the screen using a textView? Of course this would only be for a debug build.

This post contains code that prints logcat errors on the screen Write android logcat data to a file

Now all that's left to do is to put try/catch stmts in your code, where the try surrounds code you think is problematic. The catch delegates to writing the error message to your screen.



来源:https://stackoverflow.com/questions/12407797/using-logcat-on-jellybean

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