调试java流程的简便方法

可以在java文件中通过抛异常的方式查看到层级引用关系,具体代码如下

try {
    throw new Exception();
} catch (Exception e) {
    e.printStackTrace();
}

这样在出发到当前函数时,就可以在logcat中看到以system.err为TAG的层级关系调用日志了。


节省了很多跟踪流程的时间。

你可能感兴趣的:(调试java流程的简便方法)