Crashy
An Android library written entirely in Kotlin to collect crash reports and save them to storage
Usage
- Add JitPack to your project build.gradle
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
- Add the dependency in the application build.gradle
dependencies {
// androidX startup for auto-init
implementation "androidx.startup:startup-runtime:1.0.0-alpha01"
//crashy
implementation 'com.github.CraZyLegenD:Crashy:$version'
}
- In your application build.gradle add
compileOptions {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
kotlinOptions {
jvmTarget = "1.8"
}
Screens of how the stack trace info looks like
- How to use?
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>
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.