28

i dont know why but a week ago when i am debugging my app in android studio, the app in device is very slow, but if a generate the APK or use the play (Not debug) option works fine..

Anyone have idea why? I think i didnt any change in sdk or in the app to do it this..

9
  • Debugging always slows the app down. It's completely normal. You might not have noticed the delay before but it was always there. Apr 25, 2014 at 18:58
  • No, its veeeery very slow, when i click in a button it take about 5-10 seconds in show a simple toast..
    – colymore
    Apr 25, 2014 at 18:59
  • What is your version of AndroidStudio ? Did you look at IDE logs : C:\Users\<yourid>\.AndroidStudioPreview\system\log ?
    – ben75
    Apr 25, 2014 at 19:04
  • 4
    If you have ART enabled, the device will fall back to a slow (maybe non-JIT) interpreter when debugging. Combined with the need to check each instruction, it takes ages.
    – tilpner
    Apr 25, 2014 at 19:07
  • 1
    If you need faster debugging, you'll have to switch to Dalvik again.
    – tilpner
    Apr 25, 2014 at 19:08

1 Answer 1

27

When ART is enabled, the device cannot ensure the compiled code matches the bytecode instructions. It therefore cannot step through instructions and therefore lines.

This forces the device to fallback to a very slow interpreter, which possibly doesn't even JIT-compile.

For faster debugging, switch back to Dalvik.

6
  • 9
    This is pretty ridiculous! (I'm developing on my personal phone) So what happens when Android L hits devices with ART enabled by default?
    – darnmason
    Aug 8, 2014 at 14:21
  • 1
    You named a valid concern. I don't know? Let's hope they thought of something cool...
    – tilpner
    Aug 8, 2014 at 16:14
  • 3
    We can read : Debug-time issue: Interactive debugging performance was slow, even in code without breakpoints. This has been addressed in the latest AOSP code. (source.android.com/devices/tech/dalvik/art.html)
    – Arnaud
    Aug 26, 2014 at 14:57
  • Thanks this was bothering me also. I had an app with background services using bluetooth for scanning. One of my test devices had ART enabled and was a hell to debug on. Showing black screens and non responding interfaces. Solved by switching it back to dalvik!
    – hcpl
    Sep 9, 2014 at 17:09
  • 2
    Sadly, it seems we can't switch to Dalvik in Lollipop. Debugging is really painful now.
    – the_new_mr
    Apr 30, 2015 at 12:40

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.