您的位置:首页 > 其它

如何用Logcat调试u3d信息?

2016-05-09 01:35 381 查看
基本上没有人愿意写错程序,基本上也没有人能写出不出错的程序,
特别是一次写成。反正活了几十年,没见过没错的和一次成功的,所以没有不真机调试的,(还有压测,游戏效率问题,但是真正懂得不是很多)

很善慕那些作家,随便写的东西都能出书,反正写出来的东西错了也就错了,个人文风,作者观点。最近公司一个小弟问为什么不用模拟器调试,我只能再次O嘴

我的用法还是简单的
adb logcat -s Unity ActivityManager


清除之前Logcat的方法,其他也可以不用

adb logcat -c


其他logcat方法可参考这博客,但其实用的不多,不看也可,除非你是从事刷机软件开发,想必你也不会在360和百度工作

http://blog.csdn.net/avi9111/article/details/51205183

来源还是:
U3d官网论坛,网速还是不错,学学外文还是不错的
<a target=_blank href="http://answers.unity3d.com/questions/492681/how-to-use-adb-logcat.html">http://answers.unity3d.com/questions/492681/how-to-use-adb-logcat.html</a>


If you're using Unity with android, you must have already installed adb through Android SDK. Given that, yeah, it should be simple and obvious. And Ben is right. You didn't seem
to google enough or take any effort here... But I just hate simple unanswered questions.
So, quoting updated parts from Herman,
there are just a couple things to assure:

Make sure USB debugging is enabled on the Android device (check under Settings -> Development). - Run 
adb
 through
the command prompt (with command line argument logcat) that comes with the Android SDK while running the game on the Android, still connected via USB to the computer.

And then, quoting eriQue,
here's a good command line to filter out stuff:
adb logcat -s Unity ActivityManager PackageManager dalvikvm DEBUG



Finally, if the Android Debug Bridge can't help you, I'm not sure what could. There was this one time, actually, it couldn't help me... But I was ignoring a unity warning, so I did the debugging
checklist in the wrong order.

评论 ·  隐藏
16 · 分享



Ranger
Ori · 2013年11月13日
15:28 0

First, thanks for the answer.
Second, here is what I didn't know. you wrote:
"Run adb through the command prompt (with command line argument logcat) that comes with the Android SDK while running the game on the Android, still connected via USB to the computer."
I had no clue that I needed to actually copy the cmd.exe file into the "platform-tools" folder and activate the command prompt in there so it would work. (or to write to exact location of the adb.exe file in cmd)
in no tutorial there was an explanation for this, and only this guide
actually explained that
Not all of us are Software Engineers.. otherwise I would'nt ask this question. :)
By the way, this utility only shows the unity console? or is there some more important info I can get using it?



Cawas · 2013年11月13日
15:36 0

You don't need to be an engineer to know about the command prompt. But that's cool, dude. I saw your pain, reason why I decided to write a detailed answer. Glad I could hit something! ;-)
This shows the android console. It has nothing to do with Unity, it doesn't even need to know Unity exists. There might be some more important info you can get using it, but that will most likely be true only if
you're using tools outside Unity (which you probably aren't).



Ranger
Ori · 2013年11月13日
15:39 0

Then how come I receive data from the unity console? anywhere I placed "Debug.Log()" in Unity is shown through the command prompt.



Bunny83 · 2013年11月13日
16:01 3

You really don't need (and shouldn't) copy cmd.exe into the android tools folder. adb is "just" a program. To run it you have to specify the right location of the program.
This can be done by:

"browsing" to the actual folder inside your command prompt where the adb exe is located. The "cd" command (change directory) might be useful.

Create a shortcut to adb.exe and edit the shortcut properties to add additional parameters you want to pass to adb

Same as above but more versatile: Create a shortcut to cmd.exe and change the working directory to the directory of your adb location. When you open the cmd with this shortcut it should start in the tools directory
and you can directly type "adb xxxx"

The most common one is to add the directory to the default
search path. This is what i do with most tools which i know i'm going to use them quite a lot ;). If you've done that, you can start the ADB from any command prompt from any directory. Keep in mind to restart cmd or the changes wouldn't apply. Before you
ask how you add an directory to the PATH environment variable, see
this



Giantbean · 2013年11月15日
16:50 2

Another Update: My trouble was corrupt drivers. uninstalling and re-installing never worked but a Universal
ADB driver got my phone recognized by ADB. Hope that helps others save some time.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息