androiddalvikandroid-runtimedvm

Are the OAT files on other devices using the same architecture the same?


Are the OAT files on other devices using the same architecture the same? If it is not the same, can you tell me why? Thank you.

One more question, I wonder if ODEX files are the same on other devices using the same architecture


Solution

  • Most likely not. An oat file is heavily dependent on the framework of device it was compiled on. Any differences in any of the framework classes used by the dex file can cause the oat files to be different.

    Likewise with the odex case, which I'm a little more familiar with, and can give a more specific example.

    One of the specific optimizations done in an odex file is for virtual method calls, to replace the details of the method to call (class, name, parameters, return type) with a simple vtable index of the method to call.

    The layout of the vtable for a class depends on all of the virtual methods defined in the class of course. So, for example, there is a class A that normally has 5 virtual methods, but one of the OEMs adds a 6th method (e.g. maybe a protected "helper" method, whatever), then that has the possibility to change the vtable indexes of all the other methods, which means that any odex file that references that class will likely be different between the 2 devices.