"Source code does not match the bytecode" for system files on Huawei "Source code does not match the bytecode" for system files on Huawei android android

"Source code does not match the bytecode" for system files on Huawei


Apparently Huawei forked AOSP and modified it's sources. This is what many manufacturers do and it's perfectly fine as long as source passes the Compatibility Test Suite. I myself saw encrypted video playback issues on Huawei P20 related to their approach to customizing the ROM.

But getting back to the point - you can get the exact framework code running on your device from /system/framework/arm/boot.oat or boot-framework.oat or /system/framework/boot.vdex. I don't know exactly how these files are structured but it varies between Android versions and between manufacturers. Once you get these files by adb pull (You surely need root to do this) you can perform oat->dex, dex->jar using dex2jar or other tools and you'll get the source. Traditionally it was possible to get framework code from /system/framework/framework.jar but after ART was introduced these files are often empty on system images and precompiled framework code is used instead.


I believe I ran into a similar issue on my phone, but I am using a Google Pixel. I was initially concerned that the phone was compromised somehow. I think it is less likely an issue with Huawei and more likely an issue with Android Studio not keeping the source packages up to date. Your Component Installer screenshot shows Android Studio downloading revision 1 of the SDK Source - yet most SDKs are using a later revision.

I detailed the solution to my problem elsewhere on StackOverflow: Source code does not match the bytecode for Android's View.java