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..

Charles
  • 50,943
  • 13
  • 104
  • 142
colymore
  • 11,776
  • 13
  • 48
  • 90

1 Answers1

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.

tilpner
  • 4,351
  • 2
  • 22
  • 45
  • 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 08 '14 at 14:21
  • 1
    You named a valid concern. I don't know? Let's hope they thought of something cool... – tilpner Aug 08 '14 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. (https://source.android.com/devices/tech/dalvik/art.html) – Arnaud Aug 26 '14 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 09 '14 at 17:09
  • Why I didn't find this post before? The last two months have been painful to say the least. Thanks! – sigsegv Sep 11 '14 at 10:07
  • 2
    Sadly, it seems we can't switch to Dalvik in Lollipop. Debugging is really painful now. – the_new_mr Apr 30 '15 at 12:40