天天看點

crash日志 異常資訊接收器CrashWoodpecker

crash日志 異常資訊接收器CrashWoodpecker

在寫APP應用的時候經常會遇到某個Activity出問題而導緻APP崩潰,而Android Studio 自帶的 logcat 并沒有搜集到異常資訊,特别是對于那種 “啟動崩” 的異常, 很難馬上捕捉到, 丢失也是經常的。當開發過程中, 如果有沒有處理的異常導緻 crash, 使用了 CrashWoodpecker 以後, 便會起一個新的美觀頁面, 以很友好的方式即時展示異常資訊。這對于檢視錯誤資訊有很大幫助。

現在介紹怎麼使用:

1.配置build.gradle

- compileSdkVersion  
 - buildToolsVersion "21.1.2" 
 - targetSdkVersion 

           

2.引用CrashWoodpecker庫

dependencies {
 compile fileTree(dir: 'libs', include: ['*.jar'])
 debugCompile 'me.drakeet.library:crashwoodpecker:0.9.7'
 releaseCompile 'me.drakeet.library:crashwoodpecker-do-nothing:0.9.7'
}
           

3.建立一個Application類

public class App extends Application {

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

4.在Manifest.xml配置Application類

<application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:name=".App"
        android:theme="@style/AppTheme" >
           

相關顯示

crash日志 異常資訊接收器CrashWoodpecker

感謝 drakeet

相關github位址:https://github.com/drakeet/CrashWoodpecker

提示:NOTE: There is a big bug before VERSION 0.9.5, QAQ thank goodness, it has been fixed in version 0.9.5, please update to 0.9.5+.

版本0.9.5之前有個比較大的bug,是以建議選擇0.9.5之後的版本