0

I'm a newbie to Android Studio (2.1.2) and I was trying to find the call stack during a debug session. On Stack Overflow I found what I thought was the perfect question: Android Studio - Where can I see callstack while debugging an android app? ... but all the answers only referred to a window that shows the current running threads. If I'm stopped at a breakpoint it shows a red checkmark indicating I'm stopped in that thread. But clicking on it doesn't expand to a call stack.

Does "call stack" mean something different in an Android Studio? What I mean by "call stack" is that it shows that I'm stopped at line foo in routine Xyz(), and that Xyz() was called from line bar in routine Abc() and that Abc() was called from line n in routine Ijk(), etc, all the way to the beginning.

In other IDE's, e.g., Visual Studio you can click on each line in the call stack and be taken to that source code in the editor and examine the variables at the time of the call.

So if that's not called a "call stack" in Android Studio, what is it called and where can I see it in the debugger?

Community
  • 1
  • 1
user316117
  • 7,971
  • 20
  • 83
  • 158

2 Answers2

1

What you want is in the Frames pane of the Android Studio debugger. You don't actually need to click on the red checkbox when it is stopped.

The Frames pane enables you to gain access to the list of threads of your application , export to a text file and customize thread presentation. For each thread, you can view the stack frame, examine frames, navigate between frames, and automatically jump to a frame's source code in the editor. You can select a thread via a the thread selector drop-down list on top of the pane. The status and type of a thread is indicated by a special icon and a textual note next to the thread's name.

Screen shot of callstack

Jon
  • 9,156
  • 9
  • 56
  • 73
0

you can see it in

The Call Hierarchy Popup

Shortcut: Ctrl+Alt+H

enter image description here

ref: https://github.com/pavlospt/Android-Studio-Tips-by-Philippe-Breault/wiki/The-Call-Hierarchy-Popup

danilonet
  • 1,757
  • 16
  • 33
  • Ctrl+Alt+H doesn't do anything in my Android Studio (2.1.2) on Windows 7 PC. Is this a feature that comes with Android Studio or is it a 3rd-party plug-in? I did a search for the string "Call Hierarchy" on the Android Studio site https://developer.android.com/studio/intro/index.html and got no matches. – user316117 Jun 28 '16 at 15:13
  • @user316117 it is a standard key map, From Android Studio, choose Tools > Android > Android Device Monitor or click Android Device Monitor in the toolbar. Click Open Perspectives and select Hierarchy View. https://developer.android.com/studio/profile/hierarchy-viewer.html – danilonet Jun 28 '16 at 15:16
  • When I select Hierarchy View from the Android Device Monitor it puts up an empty black panel called Tree View - the word 'Hierarchy' doesn't appear anywhere. When I search on "Hierarchy View" on developer.android.com it only gives me hits on "Hierarchy View**er**" which it says is to "to debug and optimize your user interface". So this seems like some feature Google changed or removed or forgot to document. – user316117 Jun 28 '16 at 15:35