How to log hard finding crash in Android?

2019-07-20 21:38发布

问题:

I've an app which crash almost once a day, and I've used the default uncaught exception handler in order to save the crash log

e.g.

Thread.setDefaultUncaughtExceptionHandler(new CustomExceptionHandler("/sdcard/crash"));

However, for normal crash such as stackoverflow (intentional) it can be logged, but for my bug it never get logged. I guess it is because the crash is raised outside the scope of a normal activity. (yes, the crash happen when the app is in the background)

I've also tried to connect the device to my computer and log the logcat out via adb logcat > log.txt, however, the adb will timeout for a while (adb device return not connected until I re-plug it again) and the logging will stop.

So, are there any other way I can use to log and identify my bug?

Update: For those suggesting other remote logging tools, I want to say that I've already using setDefaultUncaughtExceptionHandler to save the exception to a local file, are there any exception that the tools can help but not my current method? I use for debug only, not for production

回答1:

There are a few other Crash Reporting libraries out there...

https://try.crashlytics.com/

http://hockeyapp.net/features/crashreports/

https://github.com/ACRA/acra

Just to name a few...



回答2:

Yes My brother !

You can use CrashAnalytics

Just go on this link https://crashlytics.com and put you mail id for verification and after getting approval mail you can register with your email id and use these service and you will able to get all the crashes and device information too .For Approval it will take time for one to two days

I hope this will help you.

It is permanent solution to get the crash log.You can also get the crash log after uploading the build on google play and you can assign more than one email to get the crash log for reference.