Reputation: 7913
I have a problem with the Android Studio debugger
: every breakpoint
I set inside a static method
is completely ignored. The ones set in non-static methods
, on the other hand, work perfectly.
In fact, even if I break just before calling a static method
and then manually "step into" it doesn't work. When I step into, it takes me past all the code in my static method to the first piece of code inside a non-static one.
How can I solve this? It makes finding bugs extremely difficult, since I have several helper classees
with static methods
in my project.
Additional information
Android studio version: 1.2.1.1
Testing on Galaxy s5 - Android Lollipop
Already tried invalidating cache / restarting / cleaning and rebuilding project
No overloaded methods
Didn't touch proguard rules
Minification is not enabled
The code is actually being executed (tested with logcat messages)
Example code:
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
}
Then, inside 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;
}
EDIT: please, if you -1 the question, at least say why in the comments so I can improve it. I don't know what else to add frankly :/
Upvotes: 4
Views: 1484
Reputation: 7913
As pointed out by FunkTheMonk, this was a problem with the first Lollipop release on the GalaxyS5. Updating the device to the latest firmware solved the issue.
See here for more details: Galaxy S5 Lollipop - not all breakpoints stop execution under Android Studio debugger
Upvotes: 1