piotrpo
piotrpo

Reputation: 12636

Android studio omits breakpoints

When I'm trying to debug application using android studio, I set some breakpoints in the IDE and after starting the debugger I've got an info on every single one breakpoint (in the baloon):

Warning : No executable code found at line ...

It looks like the message appears when the application reaches first BP. Just to be clear - I have executable code in those lines like String s = "asd";

Upvotes: 14

Views: 14477

Answers (8)

Piotr Siatkowski
Piotr Siatkowski

Reputation: 159

For the future:

In my case ALL lines of code were unavailable for debugger. Solution for my problem was disabling jack to avoid creation of intermediate code.

These lines in my gradle.build were to blame:

defaultConfig {
    jackOptions {
        enabled true
    }
}

I turned jack options on several months earlier and then switched back to Java7 forgetting about how my application works. No suprisde Android Studio couldn't find matching code.

I hope it will help.

Upvotes: 0

CCJ
CCJ

Reputation: 1751

I saw this error message in a pop-up over the dreaded breakpoint with an X in it, in Android Studio's "stable" version 2.1.2 (Gradle: 2.10, Android Plugin: 2.1.2), and the fix was to simply hit the red 'stop' button on the current run session in Android Studio.
I have no idea how the current run session could interfere with setting a break point in source (I have everything under 'Instant Run' unchecked), but this worked for some reason.

Upvotes: 0

totem_motorist
totem_motorist

Reputation: 157

Try to insert the next snippet code into the android{} block on the app build.gradle file:

    buildTypes {
        release {
            minifyEnabled true 
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            minifyEnabled false //<---- THIS FIX THE PROBLEM
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'pro
guard-rules.pro'
        }

    }

Upvotes: 7

Zeus56
Zeus56

Reputation: 1881

Responding to user3167086's post -

I had the same problem with the breakpoints not working in the middle of a method. One line of code was fine, and the break point icon had a "check mark" in it, but the next point had an "x" in the icon and gave the warring of "no executable code". I checked the Project Structure and the Build Type had already defaulted to "false", but I set it to false again and clicked OK.

For those using Android Studio 1.5 like I am, the complete procedure - using the main menu - is to select File -> Project Structure. Then select your "App" module on the left, and then the "Build Types" tab across the top. Make sure you have "Debug" selected and not "release" on the left (you should see this at the top of the right hand column too) and then set Minify Enabled to FALSE.

Upvotes: 1

ubuntudroid
ubuntudroid

Reputation: 3999

Make sure that you use a "Debug" build variant - otherwise breakpoints don't work.

Upvotes: 0

karma
karma

Reputation: 1298

set the minifyEnabled to false:

  1. From the project section select the project
  2. Right click on project and click open module settings
  3. select the module you are running and from Build Type set the Minify Enabled to false

Upvotes: 13

tmanthey
tmanthey

Reputation: 4615

In my case a Build - Clean Project did help.

Upvotes: 15

rminko
rminko

Reputation: 316

Do you debug on device or on emulator? If device then try to switch back to Dalvik from ART The first line breakpoint works only

Upvotes: 2

Related Questions