14

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";

4

8 Answers 8

15

In my case a Build - Clean Project did help.

0
13

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
2
  • 2
    I had the same problem with the breakpoints not working in the middle of a method. One line of code was fine, and the breakpoint icon had a "checkmark" 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.
    – Zeus56
    Commented Jan 20, 2016 at 22:12
  • It is really important to check minifyEnabled setting in build.gradle
    – einverne
    Commented Sep 18, 2016 at 9:32
7

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'
        }

    }
1
  • Great bro you save my time.
    – Bhushan
    Commented Apr 13, 2017 at 13:07
2

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

1

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.

1
  • This works for me. Minify was true; Since I have a tablet with Intel inside, didnt find "runtime" options in developer mode to switch Dalvik
    – LionisIAm
    Commented Aug 16, 2016 at 7:18
0

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

1
  • Amen. But for external jni-build the debug variant does not produce separate library outputs, and you must select the 'release' variant. This case is solved by adding "debuggable true" to the modules gradle config (under 'release'). Should probably be removed when done.
    – Paamand
    Commented Jun 14, 2017 at 14:30
0

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.

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.