Skip to content

调试时捕获程序崩溃,可提供崩溃的类名、方法名、行数、Error Log、Activity 路径、设备信息、应用信息...

License

Notifications You must be signed in to change notification settings

kingideayou/UCE-Handler

Repository files navigation

Project Status: Active – The project has reached a stable, usable state and is being actively developed. GitHub stars

UCE Handler

捕获应用的 UncaughtException,应用崩溃时提供崩溃的类名、方法名、行数、Error Log、Activity 路径、设备信息、应用信息...同时支持复制、分享和保存崩溃信息。方便在开发和测试时使用

Features

  • 监控 App 整个生命周期
  • 优雅捕获所以 UncaughtException
  • 崩溃时直接展示崩溃信息、格式化显示崩溃信息
  • 复制、分享、保存崩溃日志
  • 使用者可以拦截崩溃自行处理如何配置

提供的崩溃日志信息

  • Crash ClassNameMethodNameLineNumberCrashInfo
  • Device/mobile info.
  • Application info.
  • Crash log.
  • Activity track. //optional
  • All log files are placed in a separate folder.

示例图片

Example Image Example Animation

预览效果

Download the example app here

Setup

Project 根目录的 build.gradle 文件:

allprojects {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}

Application 或 Module 的 build.gradle 文件:

dependencies {
        debugImplementation 'com.github.kingideayou.UCE-Handler:uce_handler:1.5.2'
        releaseImplementation 'com.github.kingideayou.UCE-Handler:uce_handler_no_op:1.5.2'
}
在应用的 Application 类初始化:
  • Initialize library using builder pattern.

      public class MyApplication extends Application {
      @Override public void onCreate() {
      	...
      	// Initialize UCE_Handler Library
      	new UCEHandler.Builder(this).build();
      } }
    
Kotlin 初始化
    UCEHandler.Builder(applicationContext).build()
自定义处理崩溃信息
.setUCEHCallback(new UCECallback() {
    @Override
    public void exceptionInfo(@Nullable ExceptionInfoBean exceptionInfoBean) {
        Log.e("UCE-Handler", "exceptionInfo...");
    }

    @Override
    public void throwable(@Nullable Throwable throwable) {
        Log.e("UCE-Handler", "throwable...");
    }
})

Optional Parameters

Optional Parameters Default Desc
setUCEHEnabled(true/false) true Enable/Disable UCE_Handler.
setTrackActivitiesEnabled(true/false) false Choose whether you want to track the flow of activities the user/tester has taken or not.
setBackgroundModeEnabled(true/false) true Choose if you want to catch exceptions while app is in background.
setUCEHCallback(UCECallback) null You can handle catch exception infos yourself.

注意:「保存异常信息」需要提供读取本地存储空间权限

Authors & Contributers

Thanks To

License

Copyright © 2018 NeXT.

This project is licensed under the Apache License, Version 2.0 - see the LICENSE.md file for details

About

调试时捕获程序崩溃,可提供崩溃的类名、方法名、行数、Error Log、Activity 路径、设备信息、应用信息...

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages