(Android Studio) How to debug through my code only?

JavaDebuggingAndroid StudioStep Into

Java Problem Overview


When I try to debug through my code in Android (using Step Into, F7 command), the debugger takes me through all system classes, which I do not want.

For example, when I place a breakpoint at the 2nd line below (i.e. "startActivity(ourIntent);"), instead of going into my Activity (i.e. "myclass), the execution point goes into Activity.java > Instrumentation.java, etc... all system classes.

I dont want that. I only want to step through my code that I have written.

What is a way to achieve this?

        Intent ourIntent = new Intent(MainActivity.this, "com.practice.gamesbook.myclass");
        startActivity(ourIntent);

"Add new Pattern" option under "Debugger" > "Stepping" is disabled

enter image description here

Java Solutions


Solution 1 - Java

Go to Android Studio > Preferences > Debugger > Stepping then in the bottom click the plus arrow with the question mark that says Add Pattern. Type android.* and hit OK and then Apply.

Solution 2 - Java

For the latest version of android studios

  1. Go to File->Setting and search for Stepping

  2. click on +? sign on the right side

  3. add the following 4 patterns one by one

    com.android.*

    android.*

    com.androidx.*

    androidx.*

Solution 3 - Java

In Android Studio 2.0 select File > Settings > Build, Execution, Deployment > Debugger > Stepping. Then click the "Add Pattern" button on the right. Type android.* (or whatever pattern you want to exclude) and click "OK" twice.

Solution 4 - Java

In addition to Adam Johns's answer for ignoring the Android libraries, you can use the "Step Over" button (F8) to step over a method call the details of which you're not interested in, such as from any other library you import.

Solution 5 - Java

Use f9 (Resume Program). This will Resume your Program and stop only to the next Break Point.

Solution 6 - Java

In Android 2.3.1 Go to Android Studio > Preferences > Debugger > Stepping then in the bottom click the plus arrow icon which has dot,star and question mark which is Add Pattern. Type android.* and com.android.* and click OK and Apply.

Solution 7 - Java

Shift-F11 to step out of the method helps too.

Solution 8 - Java

1. Add Custom Pattern

Android Studio 3.x.x

Android Studio > File > Settings > Build,Execution,Deployment > Debugger > Stepping

2. Step Over(F8)

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionuser1406716View Question on Stackoverflow
Solution 1 - JavaAdam JohnsView Answer on Stackoverflow
Solution 2 - JavabeginnerView Answer on Stackoverflow
Solution 3 - JavaSilver SagelyView Answer on Stackoverflow
Solution 4 - JavaAlex NorthView Answer on Stackoverflow
Solution 5 - JavaSahil SharmaView Answer on Stackoverflow
Solution 6 - JavaostinView Answer on Stackoverflow
Solution 7 - JavaTim GlennView Answer on Stackoverflow
Solution 8 - JavaAlen LeeView Answer on Stackoverflow