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

jopen 9年前發布 | 7K 次閱讀 Android開發 移動開發 CrashWoodpecker

比 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); } }</pre>

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

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!