Android studio gradle breakpoint No executable code found at line

XMight picture XMight · Oct 4, 2016 · Viewed 18.3k times · Source

I am developing an android application using Android Studio 2.1.3 and gradle.

The problem is that the breakpoint in a simple method is never hit, although it must be hit because the condition is met during application debugging.
First, I thought that the problem is related to the issue described in the answer for this question: BuildConfig.DEBUG always false when building library projects with gradle

To test this, I removed library project and integrated all my source code into the main app module. It solved nothing. To be noted that the following is the build.gradle, where minify is set to false for both debug/release:

Here is the screenshot with what Android Studio shows to me:

No executable code found problem

This is also not the only case. It happens that the compiler, while Stepping over, jumps to completely another part of the code than the one being debugged.

Is there any reasonable explanation here? Suspend: "thread" and "all" tried, same result.

UPDATE 1: Re-created the project using Eclipse, and everything works fine. It is still amazing why using Android studio this does not work!

Answer

vinod picture vinod · Dec 29, 2016
buildTypes {

release {
    minifyEnabled true
    shrinkResources true
    proguardFiles getDefaultProguardFile('proguard-android.txt')

}
debug {
    debuggable true
    minifyEnabled false
    proguardFiles getDefaultProguardFile('proguard-android.txt')

    }
}

Set minifyEnabled false in debug block in build.gradle file.