Crocodile Crocodile - 10 days ago 22
Android Question

'Source code does not match the bytecode' when debugging on a device

I have an app which I am compiling against API level 21:
enter image description here

and then debug it on a real device with API level 23:

enter image description here

The problem is when I try debugging through the Android OS's own classes, I get 'Source code does not match the bytecode'. Why is this happening? The test device the app is running on is API level 23, and the source file being debugged is level 23 as well.
*enter image description here*

I am really confused. Can anyone explain why I am seeing this message and how I can fix it?

Answer

There's an open issue for this in AOSP, where some users have given possible solutions: https://code.google.com/p/android/issues/detail?id=225199&sort=-id&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars

The potential solutions given there (as of the date of this post) are:

  • Click Build->Clean
  • Disable Instant Run, in Settings->Build, Execution, Deployment