12

I'm trying to debug my app in my phone but Android Studio can't see some parts of my code as executable with the warning:

No executable code found at line XX in class ...

enter image description here

Following is the image of the breakpoints, I try to debug line by line bug it just skips the lines with the X breakpoints. I tried to debug in eclipse and got the same behavior.

Using:

  • Android Studio 0.4.2
  • LG G2
  • Android 4.2.2

Debugging

Is there a way to fix this?

Migore
  • 1,477
  • 3
  • 19
  • 40
  • 1
    See http://stackoverflow.com/questions/21805868/android-studio-debugger-highlights-the-wrong-lines/21866797#21866797 . It's a limitation in dx and there's nothing you can really do about it. – Scott Barta Feb 18 '14 at 22:32

6 Answers6

22

try to disable code shrinking in your build.gradle file. it's located in your projects root directory. Under buildTypes, make sure minifyEnabled is set to false. should look something like this:

buildTypes {
    release {
        minifyEnabled true
        shrinkResources true
        proguardFiles getDefaultProguardFile('proguard-android.txt')
        signingConfig signingConfigs.release
    }
    debug {
        debuggable true
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt')
        signingConfig signingConfigs.release
    }
}
guy.gc
  • 3,359
  • 2
  • 24
  • 39
8

I faced the same issue while working on my project. I'm using Android Studio 2.0 and I solved the issue by cleaning the project.

Go to Build --> Clean project

Kshitij Rana
  • 81
  • 1
  • 1
3

None of the answers from the many posts on this topic worked for me. I am using AndroidStudio2.

I had been running my code using the Debug 'app' (Shift+F9) button ...

then I tried using the normal Run 'app' (Shift+F10) button, followed by the Attach debugger to Android process button, and all the red break point circles with x's turned to checks.

After I run'd it that once, I went back to debuging it, and the break points continued to work correctly.

dsdsdsdsd
  • 2,880
  • 6
  • 41
  • 56
1

Menu Run -> Clean and Rerun.

After building and deploying, start Debug again.

netpork
  • 552
  • 7
  • 20
0

If you are using build variants open BuildVariants Tab(mostly it will be on left side of android studio), select debug for the particular module

Sateesh G
  • 23
  • 5
0

I have followed below steps

1) Clean project

2)Rebuild project

3) close Android Studio

4) Restart Android Studio.

Digvijay Machale
  • 601
  • 7
  • 12