比 Logcat 更加美观易用的异常信息接收器: CrashWoodpecker

jopen 9年前

比 Logcat 更加美观易用的异常信息接收器: CrashWoodpecker

因为我的 Android Studio 在使用的过程中, 经常会出现 App 崩溃了, 而 AS 自带的 logcat 并没有搜集到异常信息, 特别烦恼, 怎么折腾怎么重连都不痛快, 特别是对于那种 “启动崩” 的异常, 很难马上捕捉到, 丢失也是经常的.

所以我做了这么一个库, 仿造 Square 检测并展示内存泄露的 LeakCanary. 当开发过程中, 如果有没有处理的异常导致 crash, 使用了 CrashWoodpecker 以后, 便会起一个新的美观页面, 以很友好的方式即时展示异常信息. 更多内容可以参看一下我写在 GitHub 的文档:

CrashWoodpecker

A Uncaught Exception Handler library like as Square’s LeakCanary.

Getting started

In your build.gradle:

dependencies {    debugCompile 'me.drakeet.library:crashwoodpechker:0.9'    //I will add a releaseCompile to compile do nothing with the same class and package in your release build. Comming soon...  }

In your Application class:

public class ExampleApplication extends Application {       @Override public void onCreate() {      super.onCreate();      CrashWoodpecker.fly().to(this);    }  }

That is all! CrashWoodpecker will automatically show a Activity when your app crash with uncaught exceptions in your debug build.

Demo apk download: LittleWood.apk

源代码: https://github.com/drakeet/CrashWoodpecker

来自:http://drakeet.me/crashwoodpecker