在下面的代码中,我在发布的应用程序中获取异常数据。这个应用程序没有在调试模式下运行-它是作为一个发布的应用程序在许多手机上运行。
我这里的一切都很好。它将异常数据放入共享内存中,下次应用程序运行时,我会将这些数据发送给自己。我的问题是,我得到的数据不是很有用。这就是所产生的东西。。。
divide by zero StackTrace= [Ljava.lang.StackTraceElement;@7734137 Cause= null ex= java.lang.ArithmeticException: divide by zero
private Thread.UncaughtExceptionHandler onBlooey = new Thread.UncaughtExceptionHandler() {
public void uncaughtException(Thread thread, Throwable ex) {
putPref("storedexception", "Exception: " + ex);
}
}; 这并不能说明什么。不管怎么说,我可以得到一个堆栈跟踪吗?任何能告诉我程序中错误发生在哪里的信息?谢谢,迪恩
发布于 2016-11-21 23:31:57
糟了。很快就会发到。想出答案..。
private Thread.UncaughtExceptionHandler onBlooey = new Thread.UncaughtExceptionHandler() {
public void uncaughtException(Thread thread, Throwable ex) {
// quickly store the exception info and mail it to me nextime on startup
debugLog("found uncaught exception: " + ex, true);
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
ex.printStackTrace(pw);
String st = "";
st = sw.toString(); // stack trace as a string
putPref("storedexception", "Exception: " + ex + " stacktrace: " + st);
}
}; https://stackoverflow.com/questions/40730977
复制相似问题