Commit f6e839cc authored by fengruiyu's avatar fengruiyu

配置检测app崩溃工具类配置完成

parent 8d03c471
...@@ -3,9 +3,11 @@ package com.fry.base.base; ...@@ -3,9 +3,11 @@ package com.fry.base.base;
import android.app.Application; import android.app.Application;
import android.view.Gravity; import android.view.Gravity;
import me.goldze.mvvmhabit.crash.CaocConfig;
import me.goldze.mvvmhabit.utils.KLog; import me.goldze.mvvmhabit.utils.KLog;
import me.goldze.mvvmhabit.utils.ToastUtils; import me.goldze.mvvmhabit.utils.ToastUtils;
import com.fry.base.BuildConfig; import com.fry.base.BuildConfig;
import com.fry.base.R;
import com.fry.base.global.Constants; import com.fry.base.global.Constants;
import com.tencent.bugly.Bugly; import com.tencent.bugly.Bugly;
import com.tencent.bugly.crashreport.CrashReport; import com.tencent.bugly.crashreport.CrashReport;
...@@ -31,6 +33,32 @@ public class BaseModuleInit implements IModuleInit<Void> { ...@@ -31,6 +33,32 @@ public class BaseModuleInit implements IModuleInit<Void> {
// ARouter.init(application); // ARouter.init(application);
ToastUtils.setGravity(Gravity.CENTER,0,0); ToastUtils.setGravity(Gravity.CENTER,0,0);
if(isMainProcess) {
//配置全局异常崩溃操作
CaocConfig.Builder.create()
//背景模式,开启沉浸式
.backgroundMode(CaocConfig.BACKGROUND_MODE_SHOW_CUSTOM)
//是否启动全局异常捕获
.enabled(BuildConfig.DEBUG)
//是否显示错误详细信息
.showErrorDetails(true)
//是否显示重启按钮
.showRestartButton(true)
//是否跟踪Activity
.trackActivities(true)
//崩溃的间隔时间(毫秒)
.minTimeBetweenCrashesMs(2000)
//错误图标
.errorDrawable(R.mipmap.ic_launcher_main)
//重新启动后的activity
//.restartActivity(SplashActivity.class)
//.errorActivity(YourCustomErrorActivity.class) //崩溃后的错误activity
//.eventListener(new YourCustomEventListener()) //崩溃后的错误监听
.apply();
// 在主进程初始化调用哈
// BlockCanary.install(application, new AppBlockCanaryContext()).start();
}
return false; return false;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment