26

I would like to be able to execute previous breakpoint that I've just stepped over

I know Android Studio is based on Intellij Idea where it's possible link here. Similar question asking the same but its related to Eclipse IDE link here

There is also one answer that say's it's impossible. link here

I can see "Drop Frame" button. But it's disabled by default. enter image description here

So is there any way to enable this button?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Phate P
  • 1,572
  • 1
  • 22
  • 31

6 Answers6

15

The answer you are referring to regarding Eclipse is still valid for Android Studio:

You cannot step back to previous breakpoint in Android Studio because DalvikVM and Android Runtime (ART) do not support it.

You can enable the "Drop Frame" button if you debug JUnit tests as they run on a standard virtual machine (although I'm guessing this is not what you are after).

It is probably the only reason why the button exists.

Google's User Guide ignores it completely.

Maciej Beimcik
  • 3,218
  • 1
  • 24
  • 26
6

I'm fairly new to Android Studio, so I'm not entirely sure if this is what you are looking for, but have you tried playing around with the Frames window?

enter image description here

It allows you to backtrack the app's process, even reaching old breakpoints.

5

You cannot step backwards to a previous breakpoint that you have already chosen to continue past. You would have to create a saved state of your program at every break point to be able to do this, which would consume more memory than is worth designing the debugger with. You could although emulate this sort of functionality by forking your program everywhere you want to put a breakpoint.

-edit: This would be more feasible in eclipse than in android studio, as you would have to start another virtual device for android. say goodbye to your memory :p

Chris Phillips
  • 1,997
  • 2
  • 19
  • 34
0

Android 10 (Q) has supported this feature. It works well on my Pixel 2.

enter image description here

Euporie
  • 1,896
  • 1
  • 21
  • 23
-3

Please see below image

Using red down arrow to step in and blue up arrow using to step out.

:

enter image description here

Pratik
  • 97
  • 1
  • 11
-4

Use ALT + F9 for next break point.

For me (macOs Sierra) it's Previous step cmd + alt + R

Pratik
  • 97
  • 1
  • 11
  • The question is about the **previous** breakpoint, not the next one! – TDG Oct 02 '17 at 13:38
  • 2
    Did you try it? I use AS 2.3.3 on windows and it does not work. ctrl+alt+r does nothing. The *drop frame* menu item is disabled. – TDG Oct 02 '17 at 14:18