アプリケーションはマニフェストのために使用されます。マニフェストでは、これを application タグに追加するだけです (すべてのアクティビティが含まれます)。
android:name=".MyApplication"
元:
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:name=".MyApplication"
android:theme="@style/AppTheme" >
初期化が簡単なため (起動時に Android システムによって自動的に初期化されるため)、 が報告されることはありません。起動時にすぐにクラッシュし、それでも報告される可能性があります。したがって、これは非常にスマートな設定です。
私のアプリケーションクラスは次のようになります。
@ReportsCrashes(
formUri = "https://backend.com",
customReportContent = { /* */ReportField.APP_VERSION_NAME, ReportField.PACKAGE_NAME,ReportField.ANDROID_VERSION, ReportField.PHONE_MODEL,ReportField.LOGCAT },
mode = ReportingInteractionMode.TOAST,
resToastText = R.string.crash_toast_text
)
public class ACRAHandler extends Application {
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
final ACRAConfiguration config = new ConfigurationBuilder(this)
.build();
// Initialise ACRA
ACRA.init(this, config);
}
}
インスタンスに Firebase を使用している場合は、同じアプリケーション拡張クラスで問題なく両方を一緒に使用できます。自分で試してみたところ、うまくいきました。エラー報告や Firebase に問題はありませんでした。
さらに、ACRA の新しいリンクが Github に追加されました: https://github.com/ACRA/acra/wiki/BasicSetup
回答が来たのはずっと前で、更新が必要だったので、私はこれに回答しました