Android Studio:忽略静态方法中的断点
Android Studio: breakpoints in static methods are ignored
我对 Android Studio debugger
有疑问:我在 static method
中设置的每个 breakpoint
都被完全忽略了 。另一方面,non-static methods
中设置的设置完美无缺。
事实上,即使我在调用 static method
之前中断,然后手动 "step into" 它也不起作用。当我进入时,它会带我经过静态方法中的所有代码,到达非静态方法中的第一段代码。
我该如何解决这个问题?这使得查找错误变得非常困难,因为我的项目中有几个 helper classees
和 static methods
。
附加信息
Android工作室版本:1.2.1.1
在 Galaxy s5 上测试 - Android Lollipop
已经尝试使缓存无效/重新启动/清理和重建项目
没有重载方法
没有触及 proguard 规则
未启用缩小
代码 是 实际正在执行(使用 logcat 消息测试)
示例代码:
private void LoadAvailableExperiments(){ //non static methods, breakpoints work fine here
try {
List<ExperimentStoreEntry> storedExperiments = PackageHelpers.GetStoredExperiments(true); //call to static method
} catch (IOException e) {
e.printStackTrace();
}
//rest of the method
}
然后,在 PackageHelpers 里面 class:
public static List<ExperimentStoreEntry> GetStoredExperiments(boolean cleanInvalidEntries){ //static method. Breakpoints don't work here
List<ExperimentStoreEntry> entries = new LinkedList<>(); //breakpoint here is never hit
File dir = new File(IOHelpers.getExperimentsStoragePath()); //nor here
if(dir.exists()) { //nor here... etc...
for (File subdir : dir.listFiles()) {
//rest of the code I won't bore you with...
}
return entries;
}
编辑:如果您对问题 -1,请至少在评论中说明原因,以便我改进它。坦率地说,我不知道还有什么要补充的:/
正如 FunkTheMonk 所指出的,这是 GalaxyS5 上第一个 Lollipop 版本的问题。将设备更新到最新固件解决了这个问题。
详情请看这里:
我对 Android Studio debugger
有疑问:我在 static method
中设置的每个 breakpoint
都被完全忽略了 。另一方面,non-static methods
中设置的设置完美无缺。
事实上,即使我在调用 static method
之前中断,然后手动 "step into" 它也不起作用。当我进入时,它会带我经过静态方法中的所有代码,到达非静态方法中的第一段代码。
我该如何解决这个问题?这使得查找错误变得非常困难,因为我的项目中有几个 helper classees
和 static methods
。
附加信息
Android工作室版本:1.2.1.1
在 Galaxy s5 上测试 - Android Lollipop
已经尝试使缓存无效/重新启动/清理和重建项目
没有重载方法
没有触及 proguard 规则
未启用缩小
代码 是 实际正在执行(使用 logcat 消息测试)
示例代码:
private void LoadAvailableExperiments(){ //non static methods, breakpoints work fine here
try {
List<ExperimentStoreEntry> storedExperiments = PackageHelpers.GetStoredExperiments(true); //call to static method
} catch (IOException e) {
e.printStackTrace();
}
//rest of the method
}
然后,在 PackageHelpers 里面 class:
public static List<ExperimentStoreEntry> GetStoredExperiments(boolean cleanInvalidEntries){ //static method. Breakpoints don't work here
List<ExperimentStoreEntry> entries = new LinkedList<>(); //breakpoint here is never hit
File dir = new File(IOHelpers.getExperimentsStoragePath()); //nor here
if(dir.exists()) { //nor here... etc...
for (File subdir : dir.listFiles()) {
//rest of the code I won't bore you with...
}
return entries;
}
编辑:如果您对问题 -1,请至少在评论中说明原因,以便我改进它。坦率地说,我不知道还有什么要补充的:/
正如 FunkTheMonk 所指出的,这是 GalaxyS5 上第一个 Lollipop 版本的问题。将设备更新到最新固件解决了这个问题。
详情请看这里: