Android Studio 2.2.1: Slow Debugging - android

Since the update to version 2.21 the Debugging has become very slow. One exmaple: When I start my app without the debugger in completes one function in less than 2 seconds. With the debugger connected I have to wait more than 4 minutes for its completion. The update 2.2.2 did not solve this problem. What can I do to increase the debug speed again?

Make sure your debugger option is correct.

See this, it helped me massively:
Intellij Debugger slow: Method breakpoints my dramatically slow down debugging
I was waiting up to a minute when debugging for the first webservice call to return. CPU and memory monitors peaked during this period. Removed the Java Method Breakpoints and hey presto, back to normal.

check your break-points added to your code for debugging before, I fixed this problem with release break-points that added on UI function

Check as well if you didn't add function breakpoints. They are drastically slowing down the debugger.
You can check the line breakpoints in Debug menu -> View Breakpoints icon (Ctrl + Shift + F8)
The function line breakpoints are in red rhombus shape (not circle). Either disable them or better remove them.
You should observe immediate improvement in debugger speed.

Related

Android java application slow when debugging

when running application without debugger (JAVA ONLY) the app behaves as it should, meaning it is fast and crispy.
When i run the application in debug - java only debug (NO BREAKPOINTS) the app loads fragments very slow, for example custom keypad 13 buttons inflate takes 1 second, and when onResume is called and status of fragment is "visible" it still needs a second to actualy see the visible on screen.
Is my debugger faulty in some way or this is just the way it is ?
Can i speedup the debugging somehow?
With kind regards!
No your debugger is not faulty it takes time because it keep checking the origin of a functions and it helps us to debug properly. If you want to speed up your debugging than keep the code simple as possible or there is no way to speed up.
Thank you.

Android app runs very slowly after resuming from breakpoint

My Android app runs dead slow (almost frozen) after resuming from a Java breakpoint, even if I disconnect from the debugger or even unplug the USB cable. I get the same behavior on every device and emulator I've tried. Performance is great until it hits the first breakpoint, but it's unusable after I resume and I have to kill it. It's very frustrating.
It used to work great but it started with Android Studio 3.1.x and it's still happening after I upgraded to 3.2.1, then 3.3.2, the latest stable release at this time. None of my colleagues who work on the same app have this problem so it's probably not the code. I suspect I have a configuration issue somewhere.
I have no idea what changed when it started. It happens no matter where the breakpoint is. I don't see any errors in LogCat.
I'm using a MacBook Pro (15-inch, 2017) running OSX 10.13.6, Android Studio 3.3.2 (current stable release) and a Pixel XL running P. Also various emulators running P.
Any ideas or suggestions are much appreciated.
NOTE: It happens on Java breakpoints but not Kotlin.
NOTE: I cannot repro with a simple default app, so it's project specific, but only on my machine.
As #Magudesh stated, method breakpoints are very slow for the android debugger.
It's a lot more useful to just add a line breakpoint in the first line of your method and then (if it's necessary) in the last line.
That will greatly increase performance. If you then want to jump to the next breakpoint you can just hit the green play button in your debugger window.
make sure your debugger is ok .
Don't add breakpoint in the method definition. Method breakpoint will decrese the performance. Go with line breakpoint. That is better.
Please go through the difference b/w method breakpoint and line breakpoint if you are not aware.
Try to remove all the previous breakpoints that you might have added in Android Studio.
Go to the debugger window and select the View Breakpoints option and then disable all the old breakpoints and only add the new one which you want to use.

Android studio, debugging an infinite loop

I am trying to debug an infinite loop in my program in android studio. I have a lot of breakpoints set up but every time I try to run it, it gets to a point where it just says "The application is running" and stalls out until the phone runs out of memory. What tool in Android studio is there to see the flow of the program? Specifically what methods are being called and which one is being called ad infinitum.
To see your code execution stopped on breakpoint, you need to run it in debug mode Shift+F9. Normal run (Shift+F10) is not affected by breakpoints.
See this article: https://developer.android.com/tools/debugging/debugging-studio.html

Android Studio breakpoint cross explanation

I'm debugging my Android project in Android Studio using breakpoints.
I've noticed sometimes my breakpoints have a cross in them and don't pause execution.
On the intellij site this is explained as: "Shows when the breakpoint is set on a commented or non-executable line indicating that such breakpoint would not be hit."
Could anyone tell me how the above summary can explain the behaviour of the following breakpoints:
Why does the second breakpoint have a tick? I'm confused!
that's usually because the code on the connected device is different than the code on your screen.
In different words, the debugger "knows" where a break point is based on the line number on the code, so you probably added lines of code, and by that moved the line position a few lines down.
Super simple way to fix that is compile the code and flash again on the device.

Android debugger weirdness

I've been having frustrating issues with the Android debugger. I can debug and step through code sometimes, then in other parts of the code (lately in try/catch situations), it goes down to the catch {} block and there is no information on the exception and it doesn't even Log.e it to console. Notice how in the screenshot I've stepped into the catch block, but there is no live variable context, its as if it is in normal content assist mode. Watch expressions show <error(s)_during_the_evaluation>.
Can anyone shed light on these frustrating issues I'm having? The weird thing that the debugger works fine in other parts of the code.
Eclipse + ADT is notorious for acting inconsistently, which often leads me to just make sure that Project > Build Automatically is checked and then simply fire up a Project > Clean....
Sometimes even that doesn't help. So I just close Eclipse and re-start it. Works most of the time.
When even this doesn't help, I close Eclipse, run CCleaner and reboot. Works every time.
Weird but true.
You can't always believe your debugger; it's an inexact science. This is especially true when there are multiple code build steps (JVM bytecode, Dalvik code, etc). The debugger often doesn't have 100% of the information necessary to reverse engineer the location in the code back to a source code line.
In the instance above, did your code actually throw an exception, or not? It sounds like it didn't, and the debugger is showing execution on that highlighted line even though it's not really going to execute it.
I would be more inclined to believe the execution of the code - if Log.e() was never called, then you never really got any exception at all.

Categories

Resources