|
@@ -5,6 +5,15 @@ import android.content.Context;
|
|
|
import com.github.mzule.activityrouter.annotation.Modules;
|
|
import com.github.mzule.activityrouter.annotation.Modules;
|
|
|
import com.guiying.common.base.BaseApplication;
|
|
import com.guiying.common.base.BaseApplication;
|
|
|
|
|
|
|
|
|
|
+import org.acra.ACRA;
|
|
|
|
|
+import org.acra.ReportField;
|
|
|
|
|
+import org.acra.ReportingInteractionMode;
|
|
|
|
|
+import org.acra.annotation.ReportsCrashes;
|
|
|
|
|
+import org.acra.collector.CrashReportData;
|
|
|
|
|
+import org.acra.sender.EmailIntentSender;
|
|
|
|
|
+import org.acra.sender.ReportSender;
|
|
|
|
|
+import org.acra.sender.ReportSenderException;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* <p>这里是整个组件化项目管理各个组件的地方,所有需要使用的组件必须在此声明</p>
|
|
* <p>这里是整个组件化项目管理各个组件的地方,所有需要使用的组件必须在此声明</p>
|
|
|
*
|
|
*
|
|
@@ -12,6 +21,21 @@ import com.guiying.common.base.BaseApplication;
|
|
|
* @version V1.2.0
|
|
* @version V1.2.0
|
|
|
* @name MyApplication
|
|
* @name MyApplication
|
|
|
*/
|
|
*/
|
|
|
|
|
+@ReportsCrashes(
|
|
|
|
|
+ mailTo = "guiying705@Gmail.com",
|
|
|
|
|
+ mode = ReportingInteractionMode.DIALOG,
|
|
|
|
|
+ customReportContent = {
|
|
|
|
|
+ ReportField.APP_VERSION_NAME,
|
|
|
|
|
+ ReportField.ANDROID_VERSION,
|
|
|
|
|
+ ReportField.PHONE_MODEL,
|
|
|
|
|
+ ReportField.CUSTOM_DATA,
|
|
|
|
|
+ ReportField.BRAND,
|
|
|
|
|
+ ReportField.STACK_TRACE,
|
|
|
|
|
+ ReportField.LOGCAT,
|
|
|
|
|
+ ReportField.USER_COMMENT},
|
|
|
|
|
+ resToastText = R.string.crash_toast_text,
|
|
|
|
|
+ resDialogText = R.string.crash_dialog_text,
|
|
|
|
|
+ resDialogTitle = R.string.crash_dialog_title)
|
|
|
@Modules({"app", "main", "girls", "news"})
|
|
@Modules({"app", "main", "girls", "news"})
|
|
|
public class MyApplication extends BaseApplication {
|
|
public class MyApplication extends BaseApplication {
|
|
|
|
|
|
|
@@ -19,6 +43,10 @@ public class MyApplication extends BaseApplication {
|
|
|
@Override
|
|
@Override
|
|
|
public void onCreate() {
|
|
public void onCreate() {
|
|
|
super.onCreate();
|
|
super.onCreate();
|
|
|
|
|
+ //崩溃日志记录初始化
|
|
|
|
|
+ ACRA.init(this);
|
|
|
|
|
+ ACRA.getErrorReporter().removeAllReportSenders();
|
|
|
|
|
+ ACRA.getErrorReporter().setReportSender(new CrashReportSender());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -27,4 +55,22 @@ public class MyApplication extends BaseApplication {
|
|
|
// dex突破65535的限制
|
|
// dex突破65535的限制
|
|
|
//MultiDex.install(this);
|
|
//MultiDex.install(this);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 发送崩溃日志
|
|
|
|
|
+ */
|
|
|
|
|
+ private class CrashReportSender implements ReportSender {
|
|
|
|
|
+ CrashReportSender() {
|
|
|
|
|
+ ACRA.getErrorReporter().putCustomData("PLATFORM", "ANDROID");
|
|
|
|
|
+ ACRA.getErrorReporter().putCustomData("BUILD_ID", android.os.Build.ID);
|
|
|
|
|
+ ACRA.getErrorReporter().putCustomData("DEVICE_NAME", android.os.Build.PRODUCT);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void send(Context context, CrashReportData crashReportData) throws ReportSenderException {
|
|
|
|
|
+ EmailIntentSender emailSender = new EmailIntentSender(getApplicationContext());
|
|
|
|
|
+ emailSender.send(context, crashReportData);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|