Published in


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.

compile 'com.balsikandar.android:crashreporter:1.0.9'

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.

CrashReporter.initialize(this, crashReportsPath);

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
}catch(Exception e){

Log Exception API

logException(Exception e)

Check the project here to start using in your projects.

Happy coding :)

Thanks for reading this article. Be sure to click ❤ below to recommend this article if you found it helpful. It means a lot to me.

For detailed queries check out this Github repo. Happy coding.

Also let’s connect on facebook, twitter, github and linkedin.




Our community publishes stories worth reading on Android Development

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Bal sikandar

Bal sikandar

Android developer @shuttl Ex @_okcredit. Blogger | Open source contributor https://about.me/balsikandar.

More from Medium

Google developers course: Android basics in Kotlin (Part 9 Package and RecycleView)

Some Best Practices for Android App Architecture

Why You Need To Stop Closing Apps On Your Android Phone

Shortcuts in Android