Skip to content

Crash reporting, logging and analytics utilities for android

Notifications You must be signed in to change notification settings

antoche/android-debug

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

android-debug

Crash reporting, logging and analytics utilities for android

This package makes it (hopefully) a little easier to try out the various crash report services available out there.

Step-by-step guide

  • Import the code into your project

  • Add lockback-android to your project: http://tony19.github.com/logback-android/

  • Have your Application follow this model (where SomeReporter and SomeOtherReporter are two of the available reporters in the package):

      @ReportsCrashes( 
         formKey = "",
         resToastText = R.string.crash_toast_text,
         mode = ReportingInteractionMode.TOAST,
      )
      public class MyApp extends Application {
          static public Debug debug = new Debug( 
              new SomeReporter( "specialKey" ),
              new SomeOtherReporter( "https://my.server/", "user", "password" )
          );
          @Override
          public void onCreate() {
              super.onCreate();
              debug.onCreateApp(this);
          }
      }
    
  • Each reporter requires you to create an account to the corresponding service (or host it) and may require your to download the vendor's SDK as well. See "Reporters requirements" below.

  • Test the reporting by throwing an exception from somewhere in your code:

      throw new RuntimeException( "Hey, is this working?" );
    

    or try sending a handled exception to the reporter:

      // ...
      catch( Exception e )
      {
          MyApp.debug.handleException( e );
      }
    
  • If all goes according to plan, the service associated with each registered reporter should have received the crash report.

  • If something doesn't seem to work, check logcat.

  • Don't forget to read the comments and the vendor's docs.

  • You can add as many reporters as you like, except for the ACRA-based reporters (you can only have one of those). They should all work in parallel (and their exception handler should chain). If you use more than one ACRA-based reporter, they'll override each other's config and the last one will win.

  • To get the most of the log reporting, use Logback's logger via Logging.getLogger instead of Android's (see the reporters' code for examples). This allows you to send your logs in the crash reports (for those that support it) by loggin into a file without having to deal with the broken logcat permission. All log calls still go into logcat as well. It's a good idea to clean up the log file every once in a while (e.g., call Logging.deleteLog when your main activity is destroyed or stopped).

Reporters requirements

About

Crash reporting, logging and analytics utilities for android

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages