安卓Studio的调试器不会停止在中库模块断点 [英] Android Studio's debugger not stopping at breakpoints within library modules
问题描述
目前,我正在开发一个Android应用程序是基于第三方code。我开始设置断点对于理解code,很快遇到了一个问题。突然间,我不能让机器人工作室停止在断点了。
At the moment I'm developing an Android app that is based on third party code. I started to set breakpoints for understanding the code and soon ran into a problem. Suddenly I couldn't get Android Studio to stop at breakpoints anymore.
我试图设置在的onCreate
方法断点,在按钮的 OnClickListener
的S - 毫无效果。现在,我发现它工作的唯一地方是应用程序模块内。由于该项目只是有应用程序模块在一个单一的活动类和其他一切是在库模块提供的,其实我无法调试的。
I tried to set the breakpoints within onCreate
methods, within buttons' OnClickListener
s - nothing worked. Now I found out that the only place it works is inside the app module. As the project just has one single activity class in the app module and everything else is provided within library modules in fact I can't debug at all.
我认为有一些错误在AndroidManifest.xml或更可能在build.gradle文件。正如我刚才从Eclipse中切换到Android工作室,这一切摇篮东西是pretty的新的我。
I assume there's something wrong in the AndroidManifest.xml or more likely in the build.gradle file. As I just switched from Eclipse to Android Studio, all of this gradle stuff is pretty new to me.
如果我的应用程序运行时通过库断点盘旋,它告诉我,不执行code [是]在网上搜...。我想这是我的问题的原因,但我不知道如何解决它。
If I hover over a library breakpoint while the app is running, it tells me that "no executable code [is] found at line ...". I assume this is the cause of my problem, but I have no idea about how to fix it.
有没有秋后算账,在build.gradle的条目中,可能会导致我的问题?
Are there any "usual suspects" among the entries in build.gradle that could cause my problem?
我已经做了清理我的项目和无效没有成功缓存。我甚至尝试了建议,增加<活性GT;
库模块内的条目里面的片段
I already did clean my project and invalidated the cache without success. I even tried the suggestion to add <activity>
entries inside the library module for the fragments inside.
修改:我使用的是Android Studio的最新版本(版本1.1.0自2月18日),这也应有相应的漏洞修复,前一段时间存在。
Edit: I'm using the most current version of Android Studio (version 1.1.0 from February 18) which should have the similar bug fixed that existed some time ago.
build.gradle的应用程序模块中的内容:
The contents of build.gradle in the app module:
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION
defaultConfig {
minSdkVersion Integer.parseInt(project.MIN_SDK)
targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION)
}
signingConfigs {
release {
keyAlias 'xxx'
keyPassword 'xxx'
storeFile file('xxx')
storePassword 'xxx'
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
signingConfig signingConfigs.release
debuggable false
jniDebuggable false
zipAlignEnabled true
}
debug {
minifyEnabled false
debuggable true
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
productFlavors {
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':firebase_plugin')
}
和库模块的build.gradle:
And the build.gradle of library module:
apply plugin: 'com.android.library'
android {
compileSdkVersion 19
buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION
defaultConfig {
minSdkVersion Integer.parseInt(project.MIN_SDK)
targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION)
}
buildTypes {
release {
minifyEnabled true
zipAlignEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
debug {
minifyEnabled false
debuggable true
}
}
productFlavors {
}
}
dependencies {
// Facebook SDK
compile project(':facebook')
// Used for StringUtils
compile files('libs/commons-lang3-3.3.2.jar')
// Bug tracking
compile files('libs/bugsense-3.6.1.jar')
compile fileTree(include: ['*.jar'], dir: 'libs')
//Google Play Services - For Google Maps
compile('com.google.android.gms:play-services:5.0.89') {
exclude group: 'com.google.android', module: 'support-v4'
}
// Support Library.
compile 'com.android.support:support-v13:18.0.+'
compile('com.android.support:appcompat-v7:19.1.0') {
exclude group: 'com.google.android', module: 'support-v4'
}
// Volley - Networking library from google.
compile('com.mcxiaoke.volley:library:1.0.0') {
exclude group: 'com.google.android', module: 'support-v4'
}
// Has is own support library in it so need to exclude it so no TOP_LEVEL_EXCEPTION will occur.
compile('de.greenrobot:greendao:1.3.0') {
exclude group: 'com.google.android', module: 'support-v4'
}
// Firebase
compile('com.firebase:firebase-simple-login:1.4.2') {
exclude group: 'com.android.support', module: 'support-v4'
}
// Super Toast
compile('com.github.johnpersano:supertoasts:1.3.4@aar') {
exclude group: 'com.android.support', module: 'support-v4'
}
// Croping images
compile('com.soundcloud.android:android-crop:0.9.10@aar') {
exclude group: 'com.android.support', module: 'support-v4'
}
compile('com.github.chrisbanes.actionbarpulltorefresh:library:0.9.9') {
exclude group: 'com.android.support', module: 'support-v4'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
productFlavors {
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':firebase_plugin')
}
推荐答案
正如在这个问题上的意见,设置 minifyEnabled在调试版本虚假
是最好的做法。由应用模块中设置该变量要禁用整个ProGuard的构建过程。优化发行版时是非常有用的,但给出了一些问题,如果你正在测试和开发。
As stated in the comments of this issue, setting minifyEnabled false
in the debug build is the best practice. By setting this variable in the app module you are disabling the entire proguard build process. It is useful when optimizing the release build, but gives some problems if you are testing and developing.
这篇关于安卓Studio的调试器不会停止在中库模块断点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!