Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
883 views
in Technique[技术] by (71.8m points)

debugging - Android studio gradle breakpoint No executable code found at line

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:

apply plugin: 'com.android.application'  

android {  
    compileSdkVersion 23  
    buildToolsVersion "23.0.2"  
    defaultConfig {  
        applicationId "com.mycompany.mymobileapp"  
        minSdkVersion 21  
        targetSdkVersion 21  
        versionCode 1  
        versionName "1.0"  
    }  
    buildTypes {  
        release {  
            minifyEnabled false  
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'  
            debuggable true  
            jniDebuggable true  
            renderscriptDebuggable true  
            zipAlignEnabled false  
        }  
        debug {  
            debuggable true  
            minifyEnabled false  
            zipAlignEnabled false  
            jniDebuggable true  
            renderscriptDebuggable true  
        }  
    }  
    productFlavors {  
    }  
}  
  
dependencies {  
    compile fileTree(include: ['*.jar'], dir: 'libs')  
    testCompile 'junit:junit:4.12'  
    testCompile 'org.mockito:mockito-core:2.0.5-beta'  
    testCompile 'com.android.support:support-v4:23.1.1'  
    testCompile 'org.powermock:powermock-api-mockito:1.6.2'  
    testCompile 'org.powermock:powermock-module-junit4-rule-agent:1.6.2'  
    testCompile 'org.powermock:powermock-module-junit4-rule:1.6.2'  
    testCompile 'org.powermock:powermock-module-junit4:1.6.2'  
    compile 'com.android.support:appcompat-v7:23.1.1'  
}
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...