如何为异常 Android 打印堆栈跟踪 [英] How to print stacktrace for an exception Android

查看:43
本文介绍了如何为异常 Android 打印堆栈跟踪的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想打印堆栈跟踪,因为目前我正在运行.

I want to print the stack trace because at the moment I have this running.

} catch (IOException e) {
    throw new Error("Copying Failed");
}

我被告知要打印 e.stacktrace();

我该怎么做?

推荐答案

} catch (IOException e) {
    Log.e("YOUR_APP_LOG_TAG", "I got an error", e);
}

并检查 LogCat 的输出.

And check the LogCat for the output.

这篇关于如何为异常 Android 打印堆栈跟踪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆