如果App端崩溃未上报,请先确认是否未开通服务,或者事件量用尽。在排除这两种情况后,可以根据以下几种方式进行问题排查。
在初始化MonitorCrash前,打开日志开关,调用Npth.getConfigManager().setDebugMode(true),过滤npth的日志。
打开日志开关后,会出现如下配置更新日志。
2022-09-22 21:16:20.756 5319-5367/com.example.crash.test I/npth: update config 187277 : {"crash_module":{"alog_crash_before_time":"60","switcher":1,"upload_alog":"1"}} 2022-09-22 21:16:20.757 5319-5367/com.example.crash.test I/npth: after update aid 187277
如果没有打印配置更新日志,请排查以下可能的原因:
出现Java崩溃,会打印以下捕获日志。
I/npth: [uncaughtException] mLaunchCrashDisposer
如果没有打印捕获日志,请排查以下可能的原因:
Thread.UncaughtExceptionHandler handler = Thread.getDefaultUncaughtExceptionHandler(); boolean next = false; do { System.out.println("UncaughtExceptionHandler " + handler.getClass().getName()); next = false; Field[] fields = handler.getClass().getDeclaredFields(); for (Field field : fields) { field.setAccessible(true); try { Object object = field.get(handler); if (object instanceof Thread.UncaughtExceptionHandler) { handler = (Thread.UncaughtExceptionHandler)object; next = true; break; } } catch (Exception e) { e.printStackTrace(); } } } while (next);
出现Native崩溃,会打印以下捕获日志。
2022-09-22 21:33:05.023 8847-8847/com.example.crash.test E/npth: Native crash was detected! 2022-09-22 21:33:05.087 8847-8882/com.example.crash.test I/npth: [onNativeCrash] enter
如果没有打印捕获日志,请排查以下可能的原因:
ANR暂无捕获日志,捕获后会直接上报。
I/npth: uploadFromFile with allData [{"header":{"aid":"187277","update_version_code":1,"version_code":1,"app_version":"1.0","channel":"app_channel","device_id":"7550965448758202369","os":"Android","single_upload":0},"custom":{"app_custom":"app_value"},"filters":{"app_tag":"app_value"},"line_num":[{"start":0,"end":34}]},{"header":{"aid":"239017","update_version_code":123,"version_code":123,"app_version":"1.2.3","channel":"sdk_channel","package":["com.bytedance.testsdk1","com.example.crash.test"],"device_id":"7550965448758202369","os":"Android","so_list":["testsdk1.so"],"single_upload":0},"custom":{"sdk1_custom":"sdk1_value"},"filters":{"sdk1_tag":"sdk1_value"},"line_num":[{"start":14,"end":15},{"start":17,"end":21}]},{"header":{"aid":"1003","update_version_code":1,"version_code":1,"app_version":"1.1.1","package":["com.bytedance.testsdk3"],"device_id":"7550965448758202369","user_id":"1003","os":"Android","so_list":["testsdk3.so"],"single_upload":0},"custom":{"sdk3_custom":"sdk3_value"},"filters":{"sdk3_tag":"sdk3_value"},"line_num":[{"start":12,"end":14}]}]
Java崩溃和Native崩溃上传日志一致。请排查以下可能的原因:
崩溃上报成功后,崩溃相关的产物会被删除,需在崩溃发生后、上报成功前获取崩溃产物并进行检查。
https域名配置(或者直接设置个http的域名)。
android:networkSecurityConfig="@xml/network_security_config" 配置增加火山域名 <domain includeSubdomains="true">https://apmplus.volces.com</domain>
上传接口。
接口 | 含义 |
---|---|
/monitor/collect/c/crash | Java崩溃上报、ANR、Dart异常 |
/monitor/collect/c/exception | 自定义异常数据上报 |
/monitor/collect/c/native_bin_crash | native崩溃上报 |
monitor/collect/c/cloudcontrol/file | Alog上报文件 |
/settings/get | settings:配置拉取 |
/monitor/collect/c/exception/dump_collection | 启动崩溃上报 |
抓到对应的包,但是平台仍然不展示。
解压后本地导入,可以将aar复制到app的module的libs目录,然后在app的build.gradle的dependencies添加。
implementation files('libs/test-release.aar')
编译apk会增加测试入口,单击测试入口。
进入测试页面,选择测试项。