gpt4 book ai didi

Android studio gradle 断点处未找到可执行代码

转载 作者:可可西里 更新时间:2023-11-01 18:52:23 28 4
gpt4 key购买 nike

我正在使用 Android Studio 2.1.3 和 gradle 开发一个 android 应用程序。

问题是简单方法中的断点永远不会命中,尽管它必须命中,因为在应用程序调试期间满足条件。
首先,我认为这个问题与这个问题的答案中描述的问题有关: BuildConfig.DEBUG always false when building library projects with gradle

为了对此进行测试,我删除了库项目并将所有源代码集成到主应用程序模块中。它什么也没解决。需要注意的是,以下是build.gradle,其中minify对于debug/release都设置为false:

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

这是 Android Studio 向我显示的屏幕截图:

No executable code found problem

这也不是唯一的例子。碰巧编译器在单步执行时完全跳转到代码的另一部分而不是正在调试的部分。

这里有什么合理的解释吗?挂起:“thread”和“all”都试过了,结果一样。

更新 1:使用 Eclipse 重新创建项目,一切正常。仍然很奇怪为什么使用 Android Studio 这不起作用!

最佳答案

buildTypes {

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

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

}
}

在 build.gradle 文件的调试 block 中设置 minifyEnabled false

关于Android studio gradle 断点处未找到可执行代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39855656/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com