How do I obtain crash-data from my Android application?

前端 未结 30 2558
庸人自扰
庸人自扰 2020-11-22 01:10

How can I get crash data (stack traces at least) from my Android application? At least when working on my own device being retrieved by cable, but ideally from any instance

相关标签:
30条回答
  • 2020-11-22 01:41

    It is possible to handle these exceptions with Thread.setDefaultUncaughtExceptionHandler(), however this appears to mess with Android's method of handling exceptions. I attempted to use a handler of this nature:

    private class ExceptionHandler implements Thread.UncaughtExceptionHandler {
        @Override
        public void uncaughtException(Thread thread, Throwable ex){
            Log.e(Constants.TAG, "uncaught_exception_handler: uncaught exception in thread " + thread.getName(), ex);
    
            //hack to rethrow unchecked exceptions
            if(ex instanceof RuntimeException)
                throw (RuntimeException)ex;
            if(ex instanceof Error)
                throw (Error)ex;
    
            //this should really never happen
            Log.e(Constants.TAG, "uncaught_exception handler: unable to rethrow checked exception");
        }
    }
    

    However, even with rethrowing the exceptions, I was unable to get the desired behavior, ie logging the exception while still allowing Android to shutdown the component it had happened it, so I gave up on it after a while.

    0 讨论(0)
  • 2020-11-22 01:41

    Now a days Firebase Crash reports are very popular and easier to use. Please refer following link for more information: Firebase Crash Reporting

    Hope it will help you.

    0 讨论(0)
  • 2020-11-22 01:43

    I see that the question is too old, and hope my answer is helpful for others having the same issue...

    Give Crashlytics a try. It will give indepth insight into all the crashes on all the devices having your application and send a notification to you through email..And the best part is its completely free to use..

    0 讨论(0)
  • 2020-11-22 01:44

    Flurry analytics gives you crash info, hardware model, android version and live app usage stats. In the new SDK they seem to provide more detailed crash info http://www.flurry.com/flurry-crash-analytics.html.

    0 讨论(0)
  • 2020-11-22 01:45

    While many of the answers on this page are useful, it is easy for them to become out of date. The AppBrain website aggregates statistics which allow you to find the most popular crash reporting solution that is current:

    Android crash reporting libraries

    You can see that at the time of posting this picture, Crashlytics is used in 5.24% of apps and 12.38% of installs.

    0 讨论(0)
  • 2020-11-22 01:45

    Google changed how much crash reports you actually get. Previously you only got manual reported bug reports.

    Since the last developer conference and the introducation of Android Vitals you also get crash reports from users which have enabled to share diagnostics data.

    You'll see all crashes collected from Android devices whose users have opted in to automatically share usage and diagnostics data. Data is available for the previous two months.

    View crashes & application not responding (ANR) errors

    0 讨论(0)
提交回复
热议问题