简体   繁体   中英

Where do I see printed stack trace in Android Studio?

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!

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM