Skip to content
Android Studio Breakpoints: How to Debug Android Apps Faster

7 Minutes

Android Studio Breakpoints: How to Debug Android Apps Faster

Fix Bugs Faster! Log Collection Made Easy

Get started

Breakpoints are one of the most useful tools we can call on when we’re debugging applications.

If you’re not familiar, they allow us to pause execution and examine what the program is doing at that moment. And Android Studio offers a whole bunch of add-ons to supplement its core functionality.

In this guide, we’ll show you how Android Studio breakpoints work and how you can maximize their potential in your day-to-day work. Specifically, we’ll cover:

  • What Android Studio breakpoints are.
  • How breakpoints in Android Studio work.
  • How to create your first breakpoint.
  • How to step through code while debugging.

Here’s the full table of contents if you want to go straight to a specific chunk of knowledge.

What are Android Studio breakpoints?

Android Studio breakpoints are debugging markers that pause program execution so developers can inspect variables and analyze application behavior.

When the app reaches a breakpoint, Android Studio pauses execution and opens the debugger, allowing you to inspect:

  • Variable values.
  • Object states.
  • Memory references.
  • Execution flow.

This helps developers analyze the current state of the program and identify unexpected behavior more quickly.

How to use breakpoints in Android Studio

Creating a breakpoint in Android Studio takes only a few seconds. Here are the key things you’ve gotta consider.

How to add breakpoints in Android Studio

  1. Open your project in Android Studio and the Java or Kotlin file you want to debug.
  2. Click in the left gutter next to the line number. A red dot appears indicating that a breakpoint has been added.
  3. Click Debug (🐞) to start a debugging session.
Android Studio top toolbar showing the app selector, Run button, and Debug bug icon used to start a debugging session in Android Studio

When execution reaches the breakpoint:

  • The app pauses.
  • The debugger panel opens.
  • Variable values become visible.

You can now inspect the program state and really start getting your hands dirty.

How to disable or remove breakpoints in Android Studio

During debugging you may want to temporarily disable a breakpoint without removing it from the code. This allows you to keep the breakpoint location saved while focusing on other parts of the program.

In other cases, once a bug has been fixed, it’s better to remove the breakpoint entirely to keep the project clean.

To disable a breakpoint

  • Click the breakpoint icon (🔴) in the left gutter next to the line number to toggle it off. The icon becomes hollow (⭕), indicating the breakpoint is disabled but still saved.
  • Right-click the breakpoint icon and select Disable Breakpoint from the context menu.
  • Click the Mute Breakpoints button (🔇) in the debugger toolbar at the top of the Debug window to temporarily disable all breakpoints in the project.

To remove a breakpoint

  • Right-click the breakpoint icon (🔴) in the gutter and select Remove Breakpoint.
  • Or open the Breakpoints dialog using Ctrl + Shift + F8, where you can view and delete breakpoints from a centralized list.

Android Studio breakpoints example

You want to see an example, right? That’ll allow you to put some flesh on the bones and see how breakpoints work out in the wild.

Well we’ve put together this example, to show you how breakpoints in Android Studio help investigate unexpected behavior during debugging.

Imagine you are investigating a function that returns unexpected results.

To understand what is happening, you set a breakpoint, just before the conditional logic runs.

fun randomFunction(): Int {
    val randomNumber = randomInteger()

    return if (randomNumber % 2 != 0) {
        randomNumber + 1
    } else {
        randomNumber - 1
    }
}

When execution reaches this breakpoint, Android Studio pauses the program and highlights the next line that will execute.

Also, in the debugger panel below, you can see the current runtime values of variables such as randomNumber. This allows you to verify whether the function received the expected value before the conditional logic runs.

Inspect variables using breakpoints

When execution pauses at a breakpoint, the debugger panel in Android Studio will show you the current state of the program.

Something important to remember: instead of simply reading values, your goal is to verify whether they match the expected behavior of the code.

When inspecting variables, look out for:

  • Unexpected values returned by functions.
  • Incorrect parameters passed to methods.
  • Variables that change earlier than expected.
  • Objects that are null when they should exist.

By comparing the actual runtime values with what the code should produce, it becomes much easier to detect logic errors or incorrect assumptions.

If a value is already incorrect at this point, the bug likely occurred earlier in the execution flow, which is where stepping through the code becomes useful. Speaking of which…

Step through code using the Android Studio debugger

Breakpoints allow you to pause the program. Awesome. But what about when you want to see how execution continues after that point?

Here’s another cool point. Instead of placing multiple breakpoints throughout the code, the debugger allows you to step through execution one line at a time.

The debugger toolbar in Android Studio provides several useful controls in this respect:

  • Resume Program continues execution until the next breakpoint..
  • Step Over executes the current line and pauses on the next line.
  • Step Into enters a method call so you can inspect its implementation.
  • Step Out finishes executing the current method and returns to the caller.

Using these controls, you can follow the exact path the program takes during execution.

The benefits of this approach really shine through when you’re debugging complex conditions, nested method calls, or long logic chains.

Advanced breakpoint types in Android Studio

As you go on, you’ll probably evolve past the standard Android breakpoints – or you’ll want to level up the complexity and get even more control over your code.

You’ll find that Android Studio supports several advanced breakpoint types that allow you to debug more complex scenarios. Here are some of the examples we’ve found particularly useful at Bugfender.

Conditional breakpoints

A conditional breakpoint pauses execution only when a specific expression evaluates to true.

This is useful when your code runs many times (for example inside loops) but the bug appears only under certain conditions.

How to add a conditional breakpoint

  1. Add a normal breakpoint by clicking the gutter next to the line number.
  2. Right-click the breakpoint and choose Edit Breakpoint.
  3. Enter a condition such as:
  • index == 50
  • user == null
  • response.code != 200

The debugger will stop execution only when the condition becomes true.

Method breakpoints

A method breakpoint pauses execution whenever a specific method is called. This allows you to track when a function runs, even if it is invoked from many different parts of the code.

This is useful when debugging large codebases where a function may be called from many different places.

How to add a method breakpoint

  1. Open the Breakpoints dialog (Ctrl + Shift + F8).
  2. Click + and select Method Breakpoint.
  3. Enter the class and method name you want to monitor.

Android Studio will pause execution whenever that method is called.

Exception breakpoints

An exception breakpoint pauses execution whenever the application throws an exception.

These are great when you know something’s wrong but you don’t know where to look. The debugger does the detective work for you, stopping exactly where the error occurs and catching issues automatically at the point of failure.

How to add an exception breakpoint

  1. Open the Breakpoints dialog (Ctrl + Shift + F8).
  2. Click + and select Java Exception Breakpoint.
  3. Choose whether to pause on caught or uncaught exceptions.

This is one of the fastest ways to locate runtime crashes.

Some quick tips for using breakpoints in Android Studio effectively

We’ve really dug deep into Android Studio and the realm of breakpoints in Android debugging. So now, here are some quick tips you can take away with you. Each is designed to help you narrow down the source of problems and speed up your debugging sessions.

TipWhy it helps
Place breakpoints before complex logicLets you verify inputs and state before values change
Inspect variables as soon as execution pausesConfirms whether program state matches expectations
Use Step Over to follow execution line by lineHelps identify where logic diverges
Add temporary breakpoints during investigationHelps isolate specific sections of code
Use conditional breakpoints in loopsPrevents the debugger from stopping repeatedly

Final thoughts

Android Studio breakpoints are one of the most effective tools for understanding how an Android app behaves during execution.

By pausing execution, inspecting variables, and stepping through code, developers can quickly identify logic errors and unexpected behavior during development.

However, once an app is running on real devices, reproducing bugs becomes much harder.

Tools like Bugfender complement breakpoints by collecting logs and debugging information directly from users’ devices, making it easier to investigate issues that appear in production.

If you want better visibility into real-world crashes and bugs, create a free Bugfender account and start capturing logs from your apps.

Expect The Unexpected!

Debug Faster With Bugfender

Start for Free
blog author

Aleix Ventayol

Aleix Ventayol is CEO and co-founder of Bugfender, with 20 years' experience building apps and solutions for clients like AVG, Qustodio, Primavera Sound and Levi's. As a former CTO and full-stack developer, Aleix is passionate about building tools that solve the real problems of app development and help teams build better software.

Join thousands of developers
and start fixing bugs faster than ever.