AbduAlmenan / android-crash-handler

Utility library which handles crash handler configuration

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Android Crash Handler

Provides a simple way for configuring your app crash handler.

Usage

Initialize the CrashHandler instance in your Application class, and provide a global configuration by defining CrashHandlerConfiguration object.

    
   public class SampleApp extends Application {
   
       @Override
       public void onCreate() {
           super.onCreate();
   
           CrashHandlerConfiguration configuration = new CrashHandlerConfiguration.Builder(this).setLogLevel(LogLevel.FULL)
                   .setHomeActivity(MainActivity.class).build();
           CrashHandler.getInstance().init(configuration);
       }
   }

All options in CrashHandlerConfiguration.Builder are optional. Use only those you really want to customize.

See all default values for config options here.

What is actually initialized with this library???

It does multiple things:

  • initialize LeakCanary
  • setup Timber with default Debug tree
  • initialize Crashlytics
  • connect your Timber exceptions to Crashlytics with CrashReportingTree
  • setup uncaught exception handler

Crashlytics configuration

In order to use Crashlytics, you have to generate fabric.properties file in your module, and provide your apiKey and apiSecret. Remember to exclude this file from your repository.

Proguard configuration

Add following code snippet to your proguard configuration:

    -keep class org.eclipse.mat.** { *; }
    -keep class com.squareup.leakcanary.** { *; }

About

Utility library which handles crash handler configuration


Languages

Language:Java 100.0%