Skip to content

DongLab-DevTools/Android-Crash-Report-Activity

Repository files navigation

Android-Crash-Report-Activity

Hits Platform Min SDK Jitpack

한국어 README

Overview

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
image image image image

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.


Features

  • 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

Installation

Step 1: Add Jitpack repository

Add the Jitpack repository to your project's settings.gradle.kts:

dependencyResolutionManagement {
    repositories {
        google()
        mavenCentral()
        maven { url = uri("https://jitpack.io") }
    }
}

Step 2: Add dependency

Add the library to your module's build.gradle.kts:

dependencies {
    implementation("com.github.DongLab-DevTools:Android-Crash-Report-Activity:{latest.version}")
}

Requirements

  • Android API 21 (Android 5.0) or higher
  • Kotlin support

Usage

Initialize in Application class

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
            }
        }
    }
}

Custom Provider (Advanced)

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
    }
}

Available Providers

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.


Contributors

donglab
Donglab

About

크래시 정보를 화면으로 보여주는 라이브러리

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages