Unity 之 安卓堆栈跟踪和日志工具 (Android Logcat | 符号表解析Bugly捕获)
Unity 之 日志解析工具 Android Logcat
一,工具集成
Logcat是开发者必备的工具,调试app时的闪退,异常,等问题都可以在这里看到。
Android Logcat包是在Unity Editor中显示来自Android设备的堆栈跟踪和日志等消息。
1.1 注意事项
Android Logcat软件包需要Unity 2019.4或更高版本以及Android支持模块。需要添加Android模块:
导入前需要注意:确保你的工程已加载Android模块,并且可以切到Android平台。
确认后在“build Settings”窗口中切换到Android构建目标。
1.2 导入插件
在Package Manager(Window” --> PackageManager)界面中导入:
插件简介:
Android Logcat软件包支持:
-
Android:日志消息
-
Android:应用程序内存统计
-
Android:屏幕捕获
-
Android:屏幕记录器
-
Stacktrace:实用程序
可以通过“Window > Analysis > Android Logcat ”在Unity Editor中访问该窗口。
窗口打开快捷键:Windows 按“Alt+6”;macOS “Option+6”
二,连接设备
Android Logcat软件包支持USB和无线连接。本节介绍如何将Android设备连接到Android Logcat窗口。
2.1 使用USB连接
当您打开Android Logcat窗口时,Unity会自动将任何USB连接的Android设备添加到设备列表中。
手机连接上USB之后,需要选择:传输文件。若没有此选项,则需要打开开发者模式。
PS: 在手机版本上多次点击才可以唤醒出开发者模式,再次点击则有吐司提示您已处于开发者模式,这时再去更多设置中去找开发者模式并开启即可。
检测上之后,即可在窗口中看到实时日志了:
2.2 无线连接
要将Android设备连接到Android Logcat窗口:
无线连接,还是得先使用2.1方式使用USB链接一下,然后打开Android Logcat窗口,从工具栏中,选择“设备选择器”。
选择其他连接选项:
在打开的窗口中,找到对应设备点击Connect:
连接成功提示:(不使用USB方式链接,直接输入IP地址,总是链接失败,不知道为什么[\疑惑])
连接成功后,拔掉USB连接,就可以在可用设备窗口,找到Wifi链接的了:
PS:一次只能连接到一个设备。要选择要连接的设备,请使用Android Logcat窗口中的设备列表。此列表包含已连接设备的设备ID。
可以看到实时日志了:
若需要断开连接,可以在连接窗口对应设备后点击“Disconnect”:
再次连接,直接点最下面的Connect链接,即可链接成功。
三,实用功能介绍
3.1 通用介绍
-
筛选包名查看日志
点击No Filter
,在弹出的下拉菜单中,即可选择当前运行应用的包名,进行查看当前应用的相关日志:
-
筛选日志信息
Logcat工具支持在搜索框输入正则表达式检索和区分大小写功能:
-
Reconnect重新连接,Disconnect断开链接
当我们出现一个问题,需要查看日志时,为了防止日志太多将需要查看的日志刷过去,则可以点击Disconnect断开链接,停止捕获更新日志信息。需要再次查看日志时,点击Reconnect重新连接。
3.2 堆栈跟踪工具 – 解析Bugly捕获报错
在Tools
下拉菜单下选择Stacktrace Utility
可以打开工具面板:
准备工作:指定符号表)
在Project Setting
面板 -> Analysis
-> Android Logcat Settings
中设置:
PS:打包时用的哪个就导入哪个,看你打包时的工程设置:Player -> Configuration
若不指定会在解析时报错提示:
At least one symbol path needs to be specified.
Click Configure Symbol Paths and add the necessary symbol path.
举个例子:解析Bugly捕获报错
操作步骤:复制Bugly报错到工具Original
界面,然后点击Resolve Stacktraces 即可:
解析前日志:
at libunity.0x577cd8(Native Method)
at libunity.0x583bdc(Native Method)
at libunity.0x5844b8(Native Method)
at libunity.0x583870(Native Method)
at libunity.0x58380c(Native Method)
at libunity.0x1d9058(Native Method)
at libil2cpp.0x2bd4b20(Native Method)
at libil2cpp.0x2bd6008(Native Method)
at libil2cpp.0x278083c(Native Method)
at libil2cpp.0xb8dc68(Native Method)
at libil2cpp.0xb8dac8(Native Method)
at libunity.0x566cf4(Native Method)
at libunity.0x574f98(Native Method)
at libunity.0x581a0c(Native Method)
at libunity.0x5815e8(Native Method)
at libunity.0x583620(Native Method)
at libunity.0x583b44(Native Method)
at libunity.0x5844dc(Native Method)
at libunity.0x583870(Native Method)
at libunity.0x58380c(Native Method)
at libunity.0x1d9058(Native Method)
at libil2cpp.0x2bd4b20(Native Method)
at libil2cpp.0x2bd6008(Native Method)
at libil2cpp.0x278083c(Native Method)
at libil2cpp.0xb8dc68(Native Method)
at libil2cpp.0xb8dac8(Native Method)
at libunity.0x566cf4(Native Method)
at libunity.0x574f98(Native Method)
at libunity.0x581a0c(Native Method)
at libunity.0x5815e8(Native Method)
at libunity.0x583620(Native Method)
at libunity.0x583b44(Native Method)
解析后日志:
at libunity.0x577cd8 (ScriptingInvocation::ScriptingInvocation(ScriptingObjectPtr, ScriptingMethodPtr) at ??:?)(Native Method)
at libunity.0x583bdc (MonoBehaviour::InvokeMethodOrCoroutineChecked(ScriptingMethodPtr, ScriptingObjectPtr, ScriptingExceptionPtr*) at ??:?)(Native Method)
at libunity.0x5844b8 (MonoBehaviour::InvokeMethodOrCoroutineChecked(ScriptingMethodPtr, ScriptingObjectPtr) at ??:?)(Native Method)
at libunity.0x583870 (MonoBehaviour::StartCoroutine(char const*, ScriptingObjectPtr) at ??:?)(Native Method)
at libunity.0x58380c (MonoBehaviour::StartCoroutineManaged(char const*, ScriptingObjectPtr) at ??:?)(Native Method)
at libunity.0x1d9058 (MonoBehaviour_CUSTOM_StartCoroutineManaged(ScriptingBackendNativeObjectPtrOpaque*, ScriptingBackendNativeStringPtrOpaque*, ScriptingBackendNativeObjectPtrOpaque*) at ??:?)(Native Method)
at libil2cpp.0x2bd4b20 (__start_il2cpp at ??:?)(Native Method)
at libil2cpp.0x2bd6008 (__start_il2cpp at ??:?)(Native Method)
at libil2cpp.0x278083c (__start_il2cpp at ??:?)(Native Method)
at libil2cpp.0xb8dc68 (BrotliDecoderVersion at ??:?)(Native Method)
at libil2cpp.0xb8dac8 (BrotliDecoderVersion at ??:?)(Native Method)
at libunity.0x566cf4 (scripting_method_invoke(ScriptingMethodPtr, ScriptingObjectPtr, ScriptingArguments&, ScriptingExceptionPtr*, bool) at ??:?)(Native Method)
at libunity.0x574f98 (ScriptingInvocation::Invoke(ScriptingExceptionPtr*, bool) at ??:?)(Native Method)
at libunity.0x581a0c (Coroutine::InvokeMoveNext(ScriptingExceptionPtr*) at ??:?)(Native Method)
at libunity.0x5815e8 (Coroutine::Run(bool*) at ??:?)(Native Method)
at libunity.0x583620 (MonoBehaviour::TryCreateAndRunCoroutine(ScriptingObjectPtr, ScriptingMethodPtr, Coroutine**) at ??:?)(Native Method)
at libunity.0x583b44 (MonoBehaviour::HandleCoroutineReturnValue(ScriptingMethodPtr, ScriptingObjectPtr) at ??:?)(Native Method)
at libunity.0x5844dc (MonoBehaviour::InvokeMethodOrCoroutineChecked(ScriptingMethodPtr, ScriptingObjectPtr) at ??:?)(Native Method)
at libunity.0x583870 (MonoBehaviour::StartCoroutine(char const*, ScriptingObjectPtr) at ??:?)(Native Method)
at libunity.0x58380c (MonoBehaviour::StartCoroutineManaged(char const*, ScriptingObjectPtr) at ??:?)(Native Method)
at libunity.0x1d9058 (MonoBehaviour_CUSTOM_StartCoroutineManaged(ScriptingBackendNativeObjectPtrOpaque*, ScriptingBackendNativeStringPtrOpaque*, ScriptingBackendNativeObjectPtrOpaque*) at ??:?)(Native Method)
at libil2cpp.0x2bd4b20 (__start_il2cpp at ??:?)(Native Method)
at libil2cpp.0x2bd6008 (__start_il2cpp at ??:?)(Native Method)
at libil2cpp.0x278083c (__start_il2cpp at ??:?)(Native Method)
at libil2cpp.0xb8dc68 (BrotliDecoderVersion at ??:?)(Native Method)
at libil2cpp.0xb8dac8 (BrotliDecoderVersion at ??:?)(Native Method)
at libunity.0x566cf4 (scripting_method_invoke(ScriptingMethodPtr, ScriptingObjectPtr, ScriptingArguments&, ScriptingExceptionPtr*, bool) at ??:?)(Native Method)
at libunity.0x574f98 (ScriptingInvocation::Invoke(ScriptingExceptionPtr*, bool) at ??:?)(Native Method)
at libunity.0x581a0c (Coroutine::InvokeMoveNext(ScriptingExceptionPtr*) at ??:?)(Native Method)
at libunity.0x5815e8 (Coroutine::Run(bool*) at ??:?)(Native Method)
at libunity.0x583620 (MonoBehaviour::TryCreateAndRunCoroutine(ScriptingObjectPtr, ScriptingMethodPtr, Coroutine**) at ??:?)(Native Method)
at libunity.0x583b44 (MonoBehaviour::HandleCoroutineReturnValue(ScriptingMethodPtr, ScriptingObjectPtr) at ??:?)(Native Method)
相关文章
- 安卓逆向_15( 三 ) --- Android NDK 开发【 jni 静态注册、JNI_OnLoad 动态注册】
- Android 判断手机是32位CPU还是64位CPU android.os.Build类字段含义
- Android应用Preference相关及源代码浅析(SharePreferences篇)
- Android中MVP模式与MVC模式比較(含演示样例)
- Android studio 2.0--android增量更新的那些事
- Android之GPS应用开发
- Android USB转串口开发(hoho.android.usbserial串口库)
- Microsoft Azure IoTHub Serials 1 - 使用Android设备与Azure IoTHub进行交互
- 【App】Android Studio 海马玩和夜神模拟器
- 如何在 Xamarin 中快速集成 Android 版远程配置
- android:Android中用文件初始化sqlite数据库
- Android: 分页浏览的利器 android View Pager
- air for android 使用ANE来获取安卓手机IMEI号
- Android xml资源文件中@、@android:type、@*、?、@+含义和区别
- android源码-事件分发处理机制(下)-从信号源输入到处理完成的完整源码解读
- Android Studio报错:Could not find method android() for arguments
- 如何让Android手机远离间谍软件?看这里
- Android应用程序进程启动过程(后篇)
- 【Android开发经验】怎样查看android-support-v4支持包中的源代码
- Android学习笔记之:android更新ui的几种经常用法
- 【Android】Message、Handler、MessageQueue、Looper 详解
- Android回调事件传播-android学习之旅(四十五)
- 安卓开发笔记(二十一):Android Studio如何创建assets目录
- android studio 使用本地gradle的配置
- Unity调用安卓Android的Toast