我按照文档中的所有步骤在我的Android应用中使用Firebase崩溃报告(我使用Android Studio,一切都是最新的).
我使用自己的代码抛出一个异常,看它是否有效:
try {
throw new NullPointerException();
} catch (NullPointerException ex) {
FirebaseCrash.logcat(Log.ERROR, TAG, "NPE caught");
FirebaseCrash.report(ex);
}
Run Code Online (Sandbox Code Playgroud)
控制台给我这个日志:
E/MainActivity:NPE被抓住了
V/FirebaseCrash:禁用Firebase崩溃报告.
这是一个build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
// Firebase - Google Services 3.0.0
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter() …Run Code Online (Sandbox Code Playgroud)