Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't reach some lines debugging android app

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?

like image 710
Migore Avatar asked Feb 13 '14 01:02

Migore


4 Answers

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
    }
}
like image 96
guy.gc Avatar answered Nov 08 '22 07:11

guy.gc


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.

like image 39
dsdsdsdsd Avatar answered Nov 08 '22 08:11

dsdsdsdsd


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

like image 8
Kshitij Rana Avatar answered Nov 08 '22 09:11

Kshitij Rana


Menu Run -> Clean and Rerun.

After building and deploying, start Debug again.

like image 1
netpork Avatar answered Nov 08 '22 09:11

netpork