printStackTrace()为什么不打印任何内容?

huangapple go评论61阅读模式
英文:

Why doesn't printStackTrace() print anything?

问题

I am trying to catch errors made by my Android Java project. I am using the code exceptionVar.printStackTrace(), but this doesn't print anything. I was hoping that printStackTrace() would print the error to the Android Studio console, but nothing appears. In fact, nothing happens at all! There is no indication, on my Android device or in Android Studio, that any errors occurred or were printed using printStackTrace().

How do I make this method print the error to the Android Studio console? Is there a setting I can change to make printed errors appear on the console?

英文:

I am trying to catch errors made by my Android Java project. I am using the code exceptionVar.printStackTrace(), but this doesn't print anything. I was hoping that printStackTrace() would print the error to the Android Studio console, but nothing appears. In fact, nothing happens at all! There is no indication, on my Android device or in Android Studio, that any errors occurred or were printed using printStackTrace().

How do I make this method print the error to the Android Studio console? Is there a setting I can change to make printed errors appear on the console?

答案1

得分: 0

尝试查看Android Studio的Logcat,并使用printStackTrace(System.out)

英文:

Try looking at the Android Studio Logcat and using printStackTrace(System.out).

huangapple
  • 本文由 发表于 2023年4月20日 09:13:19
  • 转载请务必保留本文链接:https://go.coder-hub.com/76059863.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定