Android Debugging- CrashReporter on Duty
If someone asks me what do I do, I say: “I debug”.
Debugging is something very common for all developers. It’s the second stage of being a programmer. You got a problem, you solve it and you rock. Solving a bug gives us more pleasure than adding a feature and so many communities have evolved over the years by helping developers from all over the globe. By sharing, solving, debugging each other’s problems we have created a great learning environment.
It happens occasionally whenever we shared an APK for internal testing to our QA, the first response we get is “It’s crashing”, and when we try to reproduce, we can’t. So I made an effort to find a solution and came up with CrashReporter.
CrashReporter is a very handy tool to capture all your crashes and save them in a file locally.
Let me tell you how it works. Just add below mentioned dependency in your app’s gradle and you’re good to go.
All the crashes that it captures are written to a file in your app’s Android/data/your-package-name/files/crashReports directory. If you want to save crash logs in your own path, add this snippet in your Application class’s onCreate method with the path as an argument.
Note: These files are saved with current date and time as filenames and “_crash” as suffix.
Crash Reporter not only captures crashes but also provides APIs to log your caught exceptions.
For example, following code segment is catching an exception and logging them in a file just like crashes. Files logged using logException API has “exception” as suffix in their name.
//do your stuff
Log Exception API
Check the project here to start using in your projects.
CrashReporter is a handy tool to capture app crashes and save them in a file.
Happy coding :)