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

Folders and files

NameName
Last commit message
Last commit date

Latest commit

c522cd9 · Oct 4, 2022

History

62 Commits
Aug 3, 2021
Aug 4, 2021
Jul 29, 2021
Jun 21, 2020
Jun 18, 2020
Jun 18, 2020
Jul 29, 2021
Aug 4, 2021
Jul 8, 2020
Jun 18, 2020
Jun 18, 2020
Aug 4, 2021
Jun 18, 2020

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