user1553131
user1553131

Reputation: 105

Unable to set breakpoints in Android Studio

I am working on Ubuntu 14.04, AndroidStudio is 1.2.1.1. I am able to build the app, click on the "Debug" icon and launch the app. I can see logcat output and I can pause the app from the debugger. The one thing I cannot do is set a break point. I tried clearing the cache, restarting AS, right clicking in the file where I want to set the break point. None of these produce the desired effect. This is a well-hidden feature.

Upvotes: 7

Views: 13023

Answers (3)

Sergey Ryabov
Sergey Ryabov

Reputation: 85

To add a line breakpoint, proceed as follows:

Locate the line of code where you want to pause execution, then either click the left gutter along that line of code or place the caret on the line and press Control+F8 (on Mac, Command+F8). If your app is already running, you don't need to update it to add the breakpoint—just click Attach debugger to Android proccess . Otherwise, start debugging by clicking Debug .

Upvotes: 0

shagberg
shagberg

Reputation: 2512

I also had this same issue in Android Studio, where I couldn't set breakpoints. This is what I was doing wrong: I was clicking on a line that didn't have any code in it, or a line that contained a comment. As soon as I clicked on a line in method/class, it allowed me to set the breakpoint.

Upvotes: 11

John Difool
John Difool

Reputation: 5702

There shouldn't be any problems setting break points if you follow the process outlined here

If you are running into some issues, here are a few steps to get you started: - Use a Log.d() in your app and see if it outputs to the logs. If it doesn't then you know you are not in debug mode. - Are you debugging on the device or the emulator? If the device, you need to enable development. I would suggest to select "wait for debugger" to make sure it's attached before you run the code.

This should be pretty straightforward. Let me know what you find out.

Upvotes: 1

Related Questions