• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

"Source Code does not match bytecode"

RhinoCan

Well-Known Member
Jul 5, 2015
184
64
I'm using Android Studio 3.1.2 to develop my first Android apps.

When I am debugging and wander into one of the Android classes, like Activity.class, I frequently see a message that says "source code does not match the bytecode". This always seems to happen to the built-in classes rather than the ones I am writing myself.

Why is that happening and what can I do to fix it? It's hard to even begin to understand what is happening in a class when the cursor is on some line of code that ISN'T the one actually being executed. Have I installed something incorrectly? I didn't notice any worrisome messages during the install and I've been careful to do every update it offered me.

This is not a deal-breaker for me as long as it confines itself to the existing Android classes; I can just assume that they work and that any problem is in the code I wrote. Still, it would be nice to be able to follow what is happening in the native Android class sometimes just to understand what is happening a little better and maybe learn some cool coding tricks ;-)
 
My guess here is that you have multiple versions of a library in your project, and the deployed library is different to the one your app was built with.

Look through this SO question and try the different suggestions. I would certainly recommend doing a clean build on your project.
 
Upvote 0
My guess here is that you have multiple versions of a library in your project, and the deployed library is different to the one your app was built with.

Look through this SO question and try the different suggestions. I would certainly recommend doing a clean build on your project.

SO? Oh, Stack Overflow, right? Okay, I'll have a look at that when I get home this evening or tomorrow morning.
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones