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.
Related
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.
I developed a firebase app, where one could post and you could like and react. Then, I stopped working on it. After some time, I started working on it again, when I was working on it, I found that the app now runs very slow, I had 3 layout (fragment used) and view pager added to it via adapter(before). Beforehand it used to work like a charm, but now when I move from one activity to other, the mobile device kind of like hangs. It was not behaving like this previously, why is that? Anyone facing similar problem?
First of all I would propose you allocate a larger memory to your ADB virtual device.
If this doesn't help, use Android Profiler to better understand the cause of this memory loss.
https://developer.android.com/studio/profile/android-profiler.html
Just go to your AVD device settings and disable Device frame, this will improve the speed of your emulator
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.
I'm building the android application but I'm fed up while I'm designing my app every time I change even font size I will have to wait for re-installation is there any way to speed up this designing way?
and also
if I change the code every time I'll have to debug is there any way to speed up this task too?
My main question is if I navigated to 10 Activity and the changes are in 11
then I'll have to re-navigate every time I would be hectic. I can not move directly to the 11th activity coz I need some values from the previous activity and one more thing
something like on-web page we do just refresh that particular page and see changes
##Note: This question will help you a lot with this problem see here
I have felt that debugging on device directly is faster than using emulators. Also, if you're working in windows, its a little slower than Linux and MacOS. You can try those platforms too
Sometimes, it is inevitable that you have to re-install the apk to test some changes. In order to speed this up, the only way will be to try to fine tune your system, so that it runs faster.
For testing a simple change, like a new font size, you don't have to reinstall the apk however. You can visualize the changes inside Eclipse or use a tool like DroidDraw.
Yes, there is a faster way though, first step run the debugger in Android Studio. The first thing you notice is debugger breakpoints might slow debugging dramatically(something like that). Then click on this ...
Here you can see all the breakpoints you have in your project.
You can remove debug points left in your project in the bottom box.
This boosted my debug process in any device this is the best solution.
kishu27 is correct by saying that debugging on a device is far quicker than using the emulator. If you don't have a device available, you can keep the emulator open between runs, so you don't have to wait for it to initialize each time (which really is painfully slow).
Another tip - if you have a lot of resources in the project that results in a large APK file, you could take out all the unnecessary ones while you're debugging a particular part of the application. This can speed up the installation process if the APK becomes a fair bit smaller. (This comes from experience when I was writing an app that had many sample videos in for testing - cutting out all but one and using that one wherever possible when it didn't matter what video was there meant the APK was far smaller and vastly sped up installation time.)
While debugging my app using Monkey (which is almost as fun as the real thing), I managed to crash! Yay, that's what it's for, right?
Looking at the log (and while watching) I noticed that Monkey is occasionally doing:
:Sending Flip keyboardOpen=true
which seems to be part of my problem. When this happens, the screen in the emulator rotates 90 degrees, but this is NOT the same as a regular rotation you get by hitting KEYPAD_7. Here's a picture:
It looks to me the emulator is emulating a keyboard opening (flip), which is subtly different from a rotation.
So the question is: How do I emulate that myself? Sure, running Monkey is neat, but waiting for it to randomly choose to send a keyboardOpen message is no way to debug a program.
Maybe use the --pct-majornav to restrict the monkey to just the 'major' nav events (I'm assuming keyboard changes are 'major', I'm not sure though).
You could also look into writing a specific test based on the different but similar monkeyrunner framework: http://developer.android.com/guide/developing/tools/monkeyrunner_concepts.html ... but I don't see any way to inject keyboard flip codes.
I found this relevant SO question:
Simulating opening/closing the hardware keyboard in emulator but the "answer" there is confusing and seems insufficient.
Not really your question, but related to your root issue:
Did you forget to include 'keyboardHidden' in the 'android:configChanges' section of the manifest file? (Or did you include it, but you don't handle the config change callbacks?)
The keyboard hide/reveal will restart your activity. You can either declare that you handle that restart, or if you don't, the OS will stop and restart the app itself.
See http://developer.android.com/guide/topics/resources/runtime-changes.html
Update
I believe this is the source for the monkey application's keyboard flip event. It looks like injecting a keyboard flip event would be relatively straight-forward: Open /dev/input/input0 and write 16 magical bytes into it.
Also, the source seems to have an undocumented --pct-flip option for controlling keyboard flip rates: link