2016-12-29 151 views
4

我正在使用Firebase Crash Reporting爲什麼我沒有看到Firebase崩潰報告中的日誌

我看到here功能稱爲Logs

但是如何使用這個?

我在我的項目Google Analytics,我試圖用FirebaseCrash.log()完全相同的方法記錄崩潰。

public void sendGoogleAnalyticsEvent(String category, String label, String action) { 
    Map<String, String> build = new HitBuilders.EventBuilder() 
      .setCategory(category) 
      .setLabel(label) 
      .setAction(action) 
      .build(); 
    tracker.send(build); 
    FirebaseCrash.log("Category: " + category + " label: " + label + " action: " + action); 
} 

但是在碰撞中我看不到任何Logs。這個人談論自動記錄的事件,我也沒有看到。 有什麼不對? enter image description here

UPDATE: 如果我選擇了火力地堡菜單中的「Analytics」,還有一切都顯示並正常工作

回答

3

確保您使用的是最新版本的火力地堡崩潰報告SDK,目前10.0.1

將從Firebase Analytics導入將出現在Firebase崩潰報告中的日誌,因此您必須改用Firebase Analytics。 source

compile 'com.google.firebase:firebase-core:10.0.1' 

例如:

Bundle bundle = new Bundle(); 
bundle.putString("name", "button"); 
FirebaseAnalytics.getInstance(this).logEvent("button_click", bundle); 

throw new RuntimeException("This is a crash"); 

結果顯示在此下面的截圖

enter image description here

2

從技術文檔:

「要報告捕獲的異常,使用報告(可扔)

要將日誌消息附加到崩潰報告,請在執行過程中的點使用log(String)或logcat(int,String,String),這將最有助於您瞭解崩潰之前發生的事情。

// THIS IS ADDITIONAL INFORMATION SHOWN IN LOGS SECTION OF EACH ISSUE 
FirebaseCrash.log("User selects Settings"); 
... 

FirebaseCrash.log("User selects Enable BT"); 
... 

在你捕獲的異常處理程序:

// THIS SHOWS UP IN ISSUES IN CRASH REPORTING 
Throwable t=new Throwable("BluetoothAdapter is null in init_BT()").fillInStackTrace(); 
FirebaseCrash.report(t); 

此外,在早期用戶登錄用火力地堡分析LOGEVENT()事件也將在「日誌」的問題顯示出來,如圖答案由Wilik。

崩潰的進一步分析(來自Captech鏈接): 「當生成崩潰報告時,它會使用」app_exception「事件創建。在Analytics儀表板中創建受衆時可以使用此事件......」 [haven't這種嘗試自己尚未]

https://developers.google.com/android/reference/com/google/firebase/crash/FirebaseCrash https://www.captechconsulting.com/blogs/an-introduction-to-firebase-analytics-and-crash-reporting