Awesome
Crashy
A small 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 {
//crashy
implementation 'com.github.FunkyMuse:Crashy:$version'
}
- In your application build.gradle add
compileOptions {
sourceCompatibility = 11
targetCompatibility = 11
}
kotlinOptions {
jvmTarget = "11"
}
- 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
<img src="https://raw.githubusercontent.com/FunkyMuse/Crashy/master/screens/screen_1.png" width="33%"></img> <img src="https://raw.githubusercontent.com/FunkyMuse/Crashy/master/screens/screen_2.png" width="33%"></img> <img src="https://raw.githubusercontent.com/FunkyMuse/Crashy/master/screens/screen_3.png" width="33%"></img>
- 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.