I'm new to Android Studio and Java programming. I have the following draft code:
try {
InetAddress serverAddr = InetAddress.getByName("whatever");
Socket socket = new Socket(serverAddr, 5555);
} catch (UnknownHostException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
Socket throws exception of type IOException, so e.printStackTrace() will be called. While running this under debugger, I cannot find a place/window in Android Studio where this stack trace is printed. I guess this must be printed in Android Studio's Console window, but there is nothing printed in there. Android Studio 1.3.2, default settings. So where is this stack trace printed?
Thanks in advance!
From the Analyze menu, click Analyze Stack Trace. Paste the stack trace text into the Analyze Stack Trace window and click OK. Android Studio opens a new <Stacktrace> tab with the stack trace you pasted under the Run window.
To open the Call Stack window in Visual Studio, from the Debug menu, choose Windows>Call Stack. To set the local context to a particular row in the stack trace display, select and hold (or double click) the first column of the row.
The printStackTrace() method of Java. lang. Throwable class used to print this Throwable along with other details like class name and line number where the exception occurred means its backtrace. This method prints a stack trace for this Throwable object on the standard error output stream.
Stack trace will be send to default (console) output. In Android Studio (which is based on IntelliJ idea) is that window called logcat.
@See image below.
If you can not see this tab, go to Window > and click Restore Default Layout You can click Shift + F12 as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With