What do “Odex” and “Deodex” mean? The All Inclusive Explanation

What do "Odex" and "Deodex" mean? The All Inclusive Explanation 4
Avatar

Editorial Note: Talk Android may contain affiliate links on some articles. If you make a purchase through these links, we will earn a commission at no extra cost to you. Learn more.

What do "Odex" and "Deodex" mean? The All Inclusive Explanation 5

Show of hands, how many of you reading this have been browsing forums looking for ROMs only to come across a term completely foreign. Hey, it's OK, I've been there too. In particular, the terms Odex and Deodex notoriously cause budding Android modders' eyes to glaze over. So, what are they talking about?

To better understand deodex, you first need to know about odex.

Stock Android implements an odex file structure, with odex meaning “optimized” dalvik executable file. As your likely aware, Android apps on your device are packaged as .apk files. That all being said, what this means is that for pretty much all of your apks there is a corresponding odex file. This goes for the framework files in .jar format as well.

For instance, on this non-rooted Galaxy Nexus you'll find

system/app/Phone.apk

as well as

system/app/Phone.odex

What do "Odex" and "Deodex" mean? The All Inclusive Explanation 6

But what exactly are these odex files?
Well, when the Android OS needs to run your apps or utilize framework components, it has to parse (read/interpret) the compressed data stored in the .apk and/or .jar files. Having an odex file structure expedites this process by utilizing another file, the .odex file, which includes only the most critical data in an uncompressed format so the Android OS can quickly interpret that important information before parsing through the rest of the data held within the compressed .apks and .jars. Therefore, not all of the components of an app or framework are present in one file in an odexed sile system. I'll elaborate on why I stress that in a moment. The goal of this scheme is to boot up faster,  and generally load applications more quickly and smoother.

Ok so what is deodex?
The odexed file structure works well as an optimization tool, except for in the case of theming. Odexed apps and frameworks present a unique problem to those wanting to theme because the aspect they want to theme is broken up into two files. Typically theming involves swapping out images for home made ones, however this is simply impossible in an Odexed environment. The solution is to DeOdex the file system and reunite all of the uncompressed critical data of an app or framework back into the compressed .apk or .jar file

On this rooted Galaxy Nexus running a custom ROM we see

system/app/Phone.apk

but no longer the corresponding .odex file. The reassembled files become classes.dex

What do "Odex" and "Deodex" mean? The All Inclusive Explanation 7

So which should you run?
The fact of the matter is DeOdexing is really only useful for theming. It won't speed up your phone any.Technically it should slow it down, but in reality the difference is unnoticeable. In my experience, all custom ROMs come pre-DeOdexed, and they also zipalign your apps at boot. Zipaliging is the process of reorganizing the manner in which the .apk is packaged to optimize it for being parsed faster by the Android OS. The funny thing is, it is comparable if not better than the odex file structure, so you get the best of both worlds; a themed ROM and the speed of an optimized file structure. So really the only considerable difference lies in theming capability, and that's where the choice is yours.

 

Total
0
Shares
19 comments
  1. Well Explained!!!!
    Is there any way I could tell android to load apps(.apk and .odex) from my external memory card rather than system/app/…
    Also can u please suggest how to get custom ROM for android without rooting the phone.I am using Samsung Galaxy S Duos………..Plz help

  2. I can’t tell you how long I’ve been searching for a quality explanation to this. Thank you!

  3. Thank you for this well prepared explanation. Being a tinker of gadgets, I have learned how to put phone into download mode, recovery mode, changed my recovery to twrp, and finally, I have rooted my phone. Now, I’m looking for a simple ROM to flash. Your explanation of odex and deodexed will aid me in the choosing of a ROM. Again, Thank you.

  4. So in the case of ROM running a theme, like Mixer CM9/10 from the Play Store, is it possible to re-odex the custom ROM, or would issues arise?

  5. You’re misinformed. Odexed ROMs are not simply impossible to theme. Take a look at the MikG 2.1+3.0 ROM for the HTC EVO 4G. The developer Ammikam and others have been theming Odexed ROMs for awhile now.

    1. This is cool!

      Perhaps I’m mistaken, but I don’t think they aren’t simply theming odexed files. Rather, it seems to me that they are sort of deodexing the app, theming it, and then regenerating the .odex file. Dexopt-wrapper will allow deodexed mods to run on odexed ROMs for instance. 
      In any case, you’re right, they aren’t impossible to theme. Perhaps it would be better to say “difficult.” More work is certainly involved to theme the Odex ROM, especially for those more skilled in artwork than code modifications.

      Thanks for commenting!

Leave a Reply

Your email address will not be published. Required fields are marked *