06-20 15:54:35.331 23889 23889 I DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 06-20 15:54:35.331 23889 23889 I DEBUG : Build fingerprint: 'google/razorg/deb:4.4.2/KOT49H/937116:user/release-keys' 06-20 15:54:35.331 23889 23889 I DEBUG : Revision: '0' 06-20 15:54:35.331 23889 23889 I DEBUG : pid: 1981, tid: 2020, name: Thread-3399 >>> com.guangyou.ddgame <<< 06-20 15:54:35.331 23889 23889 I DEBUG : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000028 06-20 15:54:35.431 187 710 D audio_hw_primary: out_set_parameters: enter: usecase(0: deep-buffer-playback) kvpairs: routing=2 06-20 15:54:35.511 23889 23889 I DEBUG : r0 76d94458 r1 00000000 r2 00000000 r3 00000000 06-20 15:54:35.511 23889 23889 I DEBUG : r4 760c1a48 r5 751e2440 r6 00000001 r7 760c1a48 06-20 15:54:35.511 23889 23889 I DEBUG : r8 00000001 r9 76c96f3c sl 76c861c0 fp 76d94444 06-20 15:54:35.511 23889 23889 I DEBUG : ip 00000001 sp 76d94430 lr 75a81bd8 pc 75a81bdc cpsr 600f0010 06-20 15:54:35.511 23889 23889 I DEBUG : d0 746968775f327865 d1 6a6e6169642f675f 06-20 15:54:35.511 23889 23889 I DEBUG : d2 5f6f616978757169 d3 676e702e6e776f6d 06-20 15:54:35.511 23889 23889 I DEBUG : d4 0000000009000000 d5 0000000000000000 06-20 15:54:35.511 23889 23889 I DEBUG : d6 0000000000000000 d7 0000000000000000
怎样获取android的系统日志android
假设你已经安装了 Android Develop Tools, 能够成功调用adb. 并打开android开发用机的调试模式, 链接到电脑.c++
打开命令行, 在命令行输入: adb logcat
. 就能够看到满屏幕的日志啦. 输入adb logcat --help
能够看到 logcat的用法提示.工具
这里有两个参数特别提醒一下, 比较经常使用:ui
若是须要保存log到文件, 方便之后查看. 可输入命令: adb logcat -v threadtime -d > log.txt
google
利用ndk-stack定位崩溃代码命令行
上面的一些信息能简单的帮你定位如下问题. 若是信息量还不够大的话, 那就还有最后一招: 还原历史.线程
Android NDK自从版本R6开始, 提供了一个工具ndk-stack( 在目录{ndk_root}/中 ). 这个工具能自动分析dump下来的crash log, 将崩溃时的调用内存地址和c++代码一行一行对应起来.unix
咱们先看一下用法, 执行命令ndk-stack --help调试
Usage: ndk-stack -sym <path> [-dump <path>] -sym Contains full path to the root directory for symbols. -dump Contains full path to the file containing the crash dump. This is an optional parameter. If ommited, ndk-stack will read input data from stdin
-dump参数很容易理解, 即dump下来的log文本文件. ndk-stack会分析此文件. -sym参数就是你android项目下,编译成功以后,obj目录下的文件.
adb logcat | ndk-stack -sym ./obj/local/armeabi
日志