我正在开发一个Android应用程序使用Android Studio 2.1.3和gradle。Android工作室gradle断点在行
问题是,一个简单方法中的断点从来没有命中,但它必须被命中,因为在应用程序调试过程中满足条件。
首先,我认为这个问题是关系到答案为这个问题所描述的问题: BuildConfig.DEBUG always false when building library projects with gradle
为了测试这一点,我删除库项目和综合我所有的源代码,进入主应用程序模块。它什么也没解决。 要注意的是,以下是的build.gradle,在缩小设置为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显示我的截图:
这也并不是唯一的案例。碰巧,编译器在Stepping结束时跳转到代码的另一部分,而不是被调试的部分。
这里有什么合理的解释吗? 暂停:尝试“线程”和“全部”,结果相同。
UPDATE 1: 使用Eclipse重新创建项目,并且一切正常。 为什么使用Android工作室这是不行的!
这不是解决这个问题的方法......即时运行在大多数情况下都很有效。你浪费你的时间只是因为你不知道当你在任何编辑器遇到这个问题时,干净始终是第一选择,这是众所周知的。但是我想知道是否有这方面的错误报告,或者是因为它会驱动我的坚果,即使它每周只发生一次。 – Renetik
在我的情况下,它一直在发生。你想和C,C++,C#和Java等许多编辑和6年的经验争论,并告诉我,我不知道如何清理一个项目?请不要再写这些无用的评论。可悲的是我不能向你投票评论。另外,这不会发生在我身上。此后与许多其他全职Android开发人员一起讨论,并且由于这样的错误,他们默认立即关闭。 – XMight
好,所以你清理项目和brakpoint仍然没有奏效?所以这是另一个问题,因为在即时运行打开的情况下,这种情况从来没有发生过,并且我在测试版发布后使用它。你没有提到你一次在你的回答和问题中清理过项目,所以我的评论怎么没用。投票,但是你想要的。那就是它的用途。 – Renetik