简体   繁体   中英

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??

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"

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...

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
  • [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. 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 ):

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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