Unity3D利用Logcat调试安卓

发布安卓包之后再次测试发生什么问题很难知道怎么了,比如说出现闪退等情况,可以用Logcat检测到,logcat是Android中一个命令行工具,可以用于得到程序的log信息,可以用 logcat 命令来查看系统日志缓冲区的内容.

用模拟器运行安卓程序或者真机也可以进行测试

它的位置在SDK/platform-tools中。

指令格式

  [adb] logcat [<option>] ... [<filter-spec>] ...

option部分

V — Verbose (lowest priority)
D — Debug
I — Info
W — Warning
E — Error
F — Fatal
S — Silent (highest priority, on which nothing is ever printed)

Option Description
-b<buffer> 加载一个可使用的日志缓冲区供查看,比如event 和radio . 默认值是main 。具体查看Viewing Alternative Log Buffers.
-c 清楚屏幕上的日志.
-d 输出日志到屏幕上.
-f<filename> 指定输出日志信息的<filename> , 默认是stdout .
-g 输出指定的日志缓冲区,输出后退出.
-n <count> 设置日志的最大数目<count> ., 默认值是4,需要和 -r 选 项一起使用。
-r <kbytes> 每<kbytes> 时 输出日志,默认值为16,需要和-f 选 项一起使用.
-s 设置默认的过滤级别为silent.
-v <format> 设置日志输入格式,默认的是brief 格 式,
要知道更多的支持的格式,参看Controlling Log Output Format.

 

我们可以用CMD cd到这个文件夹中,在输入命令adb logcat来在cmd中实时看log信息

adb logcat -s Unity只查看unity的信息

adb logcat -d > xxx.txt 将之前log信息输出到txt中

同理adb logcat -s Unity -d > xxx.txt将之前Unity的log信息输出到txt中


成功找到了问题所在

 

更详细的相关内容可以参考:http://www.miui.com/article-272-1.html

小米真机抓log方法:http://www.miui.com/thread-397214-1-1.html

 

by wolf96 2017/7/13

 

 

 

 

posted @ 2017-07-30 15:01  战狼96  阅读(3082)  评论(0编辑  收藏  举报