移除全局异常捕获后杀死进程功能
This commit is contained in:
parent
3d5ac05d36
commit
11cf971514
@ -278,17 +278,17 @@ public class AppContext extends CommonAppContext {
|
|||||||
Log.e("ApplicationError", "主线程异常");//此处log只是展示,当debug为true时,主类内部log会打印异常信息
|
Log.e("ApplicationError", "主线程异常");//此处log只是展示,当debug为true时,主类内部log会打印异常信息
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
//闪退后finish所有Activity并且杀死进程
|
//闪退后finish所有Activity并且杀死进程
|
||||||
for (WeakReference<Activity> activity : activities) {
|
/* for (WeakReference<Activity> activity : activities) {
|
||||||
if (activity != null && activity.get() != null) {
|
if (activity != null && activity.get() != null) {
|
||||||
activity.get().finish();
|
activity.get().finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Process.killProcess(Process.myPid());
|
*//* Process.killProcess(Process.myPid());
|
||||||
System.exit(0);*/
|
System.exit(0);*//*
|
||||||
setFirebaseCrashData();
|
setFirebaseCrashData();
|
||||||
new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}, 100);
|
}, 100);*/
|
||||||
})
|
})
|
||||||
.setUncaughtCrashHandler((t, e) -> {
|
.setUncaughtCrashHandler((t, e) -> {
|
||||||
Log.e("ApplicationError", "子线程异常");//此处log只是展示,当debug为true时,主类内部log会打印异常信息
|
Log.e("ApplicationError", "子线程异常");//此处log只是展示,当debug为true时,主类内部log会打印异常信息
|
||||||
|
@ -101,10 +101,10 @@ public class NeverCrashUtils {
|
|||||||
Log.e(TAG, "未捕获的主线程异常行为", e);
|
Log.e(TAG, "未捕获的主线程异常行为", e);
|
||||||
}
|
}
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
Toast.makeText(application, "发生闪退", Toast.LENGTH_SHORT).show();
|
Toast.makeText(application, "发生闪退:"+e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||||
FileUtil.saveStringToFile(new File(application.getDir("files", Context.MODE_PRIVATE).getAbsolutePath()), throwableToString(e), "error.log");
|
FileUtil.saveStringToFile(new File(application.getDir("files", Context.MODE_PRIVATE).getAbsolutePath()), throwableToString(e), "error.log");
|
||||||
getMainCrashHandler().mainException(Looper.getMainLooper().getThread(), e);
|
getMainCrashHandler().mainException(Looper.getMainLooper().getThread(), e);
|
||||||
return;
|
// return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user