android - Log for android app in play console vitals
问题描述
I have an app in google play and for some reason, I get a rare IllegalArgumentException
for a method with multiple args. It happens in 0.004% according to google statistics (in my app usage), so there is no way I can reproduce it to know how to solve it, and google play vitals doesnt provide any usable info to what arg was a NULL
.
There are a lot of log.X (x = d, e, w...) and I know the basics, but what I dont understand is, can I use some of them to get info on an argument that was NULL
when user was using the app? Can I write a log.e("TAG", arg4.toString())
, put it in try/catch block and build it for production, so when crash happens, it will print the value of arg4
in google play vitals?
If not, how do I find out which arg was NULL
in such a rare case?
解决方案
Play Console 中的 Vitals 部分报告崩溃,而不是日志,因此您可以捕获异常并在消息中抛出另一个包含更多数据的异常,但 AFAIK 异常消息通常会在显示在 Play Console 中之前被删除,以防万一它揭示了有关用户的私人数据。
另一种选择是与 Firebase 集成并存储和收集数据,但这可能是值得投入的更多努力。
如果我是你,我会检查源代码(你的应用程序、你正在使用的库或 Android 源代码)哪一行引发了非法参数异常,并检查在这一行检查了哪些参数。
最后,如果这不是一个选项,您可以在调用该方法之前自己在代码中抛出异常,检查每个参数是否为非空。根据抛出的行,您将知道哪个参数为空。
推荐阅读
- python - 使用模式作为颜色 Osmnx 和 Python 绘制路线
- java - 日志数据,java,csv
- arrays - 不同类型的 Swift 数组
- eclipse - BIRT 生成的 PDF 中的条形码
- vue.js - 我可以向 Vuetify datepicker 添加自定义翻译吗?
- javascript - TD 没有与 Outlook 叠加响应
- scala - 无法使用 spark scala 读取发布到 kafka 主题的 twitter 数据
- swift - GPUImage3 模拟器错误(`错误:MPS 不支持 iOS 模拟器。')
- java - 与java8兼容的seedstack版本
- reactjs - 为什么nextjs中没有显示数据?