简体   繁体   English

可以向Proguard崩溃报告中添加变量(Google Play ANR和块)

[英]it's possible add a variable to the Proguard Crash Report (Google Play ANR & Blocks)

anybody can explain if it's possible to attach a variable to the proguard crash reports?? 任何人都可以解释是否有可能在Proguard崩溃报告中附加变量?

I mean something like this: 我的意思是这样的:

java.lang.NullPointerException: 
    at es.com.myapp.dashboardActivity$askForUserBills.doInBackground (dashboardActivity.java)   or                     .onPostExecute (dashboardActivity.java)
    at es.com.myapp.dashboardActivity$askForUserBills.onPostExecute (dashboardActivity.java)
    at android.os.AsyncTask.finish (AsyncTask.java:660))

**Application Variables: userID="967234112", myJsonObject=null << Something like this...**

In this example I requested "userID" and "myJsonObject" 在此示例中,我请求了“ userID”和“ myJsonObject”

It will be a great if it's possible, because you can check if your incoming data from a database in a specific user is corrupted, if X is malformed or null, etc... 如果可以的话,这将是一个很好的选择,因为您可以检查特定用户从数据库中传入的数据是否已损坏,X格式是否错误或为null等。

Thanks all! 谢谢大家!

If you know you want to check something it is really easy. 如果您知道要检查某件事,那真的很容易。 Instead of just relying on the code crashing, validate your input data to check if it is null. 验证输入数据以检查是否为空,而不仅仅是依靠代码崩溃。 Then if it is you have a number of options: 然后,如果有,则有许多选择:

  • use a service like Firebase Analytics to record the error 使用Firebase Analytics之类的服务记录错误
  • [not recommended] throw a more detailed exception with an error message [不推荐]抛出更详细的异常并显示错误消息

Crashes should only happen because of bugs in your code. 仅由于代码中的错误而导致崩溃。 You shouldn't be using them to record / trace input validation problems, as that really sucks for your users. 您不应该使用它们来记录/跟踪输入验证问题,因为这对于您的用户来说确实很糟糕。 Instead, write more robust code, and recover gracefully, while using a logging solution to find the bugs. 而是编写更健壮的代码,并在使用日志记录解决方案查找错误的同时正常恢复。

use Firebase Crashlyics instead. 请改用Firebase Crashlyics there you can report whenever you catch an Exception , instead of just logging to log-cat (currently only could find the Android documentation on fabric.io , which will soon be superseded by Firebase Crashlytics ): 在那里,您可以在捕获到Exception时进行报告,而不仅仅是登录到log-cat(当前只能在fabric.io上找到Android文档,该文档很快将被Firebase Crashlytics取代):

Crashlytics.log("Application Variables: userID="967234112", myJsonObject=null");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM