Android-Crash-Report-Activity is a debug library that displays crash information in a UI when the app terminates due to a crash.
It provides comprehensive crash details including app information, device information, memory status, network status, and stack trace.
| Sample Screen | Crash Info Screen 1 | Crash Info Screen 2 | Share Feature |
|---|---|---|---|
![]() |
![]() |
![]() |
![]() |
This library solves the problem of non-reproducible crashes during development and QA testing. When a crash occurs, it displays detailed crash information in a shareable UI, allowing QA testers and developers to immediately capture and share crash logs even when the issue can't be reproduced.
- Automatic Crash Detection: Automatically catches uncaught exceptions and displays crash information
- Comprehensive Information Collection: Collects crash time, screen name, exception details, app info, device info, build info, thread info, memory status, and network status
- Clean UI Design: Displays crash information in a well-organized, readable format with proper styling
- Share Functionality: Allows users to share crash reports via any sharing-enabled app
- Customizable Providers: Supports custom crash information providers through a clean DSL API
- Zero Configuration: Works out of the box with sensible defaults, while still being highly customizable
Add the Jitpack repository to your project's settings.gradle.kts:
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}Add the library to your module's build.gradle.kts:
dependencies {
implementation("com.github.DongLab-DevTools:Android-Crash-Report-Activity:{latest.version}")
}- Android API 21 (Android 5.0) or higher
- Kotlin support
To enable crash reporting, simply call installCrashHandler in your Application class:
class MyApplication : Application() {
override fun onCreate() {
super.onCreate()
installCrashHandler(this) {
providers {
useDefault() // Use all default providers
}
}
}
}You can add custom crash information providers by implementing the CrashInfoProvider interface:
class MyCustomProvider : CrashInfoProvider {
override fun collect(
context: Context,
throwable: Throwable,
thread: Thread,
activityName: String
): CrashInfoSection? {
return CrashInfoSection(
title = "Custom Info",
type = SectionType.NORMAL,
items = listOf(
CrashInfoItem(
label = "Custom Field",
value = "Custom Value",
type = ItemType.NORMAL
)
)
)
}
}
// Add custom provider
installCrashHandler(this) {
providers {
useDefault() // Use default providers
add(MyCustomProvider()) // Add your custom provider
}
}The library includes several built-in providers that are automatically used when you call useDefault():
- BasicInfoProvider (Required): Collects crash time and screen name
- ExceptionInfoProvider (Required): Collects exception type, message, and stack trace
- AppInfoProvider: Collects app version, package name, and version code
- BuildInfoProvider: Collects build-related information (SDK version, manufacturer, etc.)
- DeviceInfoProvider: Collects device model, Android version, and hardware info
- ThreadInfoProvider: Collects information about the thread where the crash occurred
- MemoryInfoProvider: Collects memory usage information (heap size, available memory, etc.)
- NetworkInfoProvider: Collects network connection status
You can use all default providers with useDefault(), or selectively add only the providers you need.
|
Donglab |



