Can the execution point of a Java application be modified or specified while debugging under Android Studio

I am using Android Studio IDE (v1.5.1) and its Gradle debugger to step thru my Java application. I can single-step, step-over, step-out, break, set breakpoints etc., but I cannot find a way to manually set the next instruction/statement to be executed or alter the execution flow.

An example of this feature is Visual Studio’s “Set next statement” under the DEBUG menu. Another example is MSDOS’s g =address where you can specify the next instruction to be executed.

Does the Android Studio Debugger provide a means to change or specify the execution point of the target application?


While this is not possible, I usually workaround in the case of simple blocks of code that I might want (or not) to jump.

First you catch the block in a if statement:

       int foo = bar.toFoo();
       boolean doThis = Boolean.TRUE;
(B)    if (doThis) {
          // stuff that I might want to jump

Here (B) is a breakpoint. Now when it is reached, I just click Evaluate expression and, if needed, evaluate doThis = false;.

One might argue that a decent compiler should get rid of doThis, but it actually works in Android Studio 1.5, probably thanks to Boolean.TRUE instead of true.

If willing to, Evaluate expression will also let you execute full blocks of code while stuck at the breakpoint.