Skip to content

A tiny library to save your crash reports to the device's storage with lots of details of what went wrong.

License

Notifications You must be signed in to change notification settings

FunkyMuse/Crashy

Repository files navigation

Crashy

A small Android library written entirely in Kotlin to collect crash reports and save them to storage.

Kotlin Platform API API

Usage

  1. Add JitPack to your project build.gradle
allprojects {
  repositories {
    ...
    maven { url 'https://jitpack.io' }
   }
}
  1. Add the dependency in the application build.gradle
dependencies {
    //crashy
    implementation 'com.github.FunkyMuse:Crashy:$version'
  }
  1. In your application build.gradle add
   compileOptions {
        sourceCompatibility = 11
        targetCompatibility = 11
    }

    kotlinOptions {
        jvmTarget = "11"
    }
  1. Inside your AndroidManifest.xml file
 <provider
   android:name="androidx.startup.InitializationProvider"
   android:authorities="${applicationId}.androidx-startup"
   android:exported="false"
   tools:node="merge">
       <meta-data
          android:name="com.crazylegend.crashyreporter.initializer.CrashyInitializer"
          android:value="androidx.startup" />
</provider>

Screens of how the stack trace info looks like

  1. How to use?

Get logs

//as a list of strings
CrashyReporter.getLogsAsStrings()

//as a list of files
CrashyReporter.getLogFiles()

Get all logs and purge them afterwards

//as a list of strings
CrashyReporter.getLogsAsStringsAndPurge()

//as a list of files
CrashyReporter.getLogFilesAndPurge()

Manually log an exception

CrashyReporter.logException(thread: Thread, throwable: Throwable)

CrashyReporter.logException(exception: Throwable)

Purge logs

CrashyReporter.purgeLogs()

Get dump folder

val folder: File = CrashyReporter.dumpFolder

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

Apache 2.0