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

by Jim Farmer on
tagged ,

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

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

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.

 

» See more articles by Jim Farmer


  • vopwriter

    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.

    • Anonymous

      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!

      • Butsilias

        hei take a look at nobodyAtall’s work on  x10mini minicm 7 is odexed and themed 

  • http://profile.yahoo.com/DM7H577SLJT7JPIQDSYSWQRERQ Kand Aon

    great article, and very good explanation
    thank you

  • http://twitter.com/bbmatic .

    thanks for thie info. 

  • http://repair-mobiles.com/ Mobile Saaqi

    Thanks for the information, I guess I am sticking to my Stock Rom

  • http://aaqil.co.uk/ Aaqil Mahmood

    Thanks, this is the easiest odex explanation. I would go for odex because performance matters to me.

  • http://www.facebook.com/profile.php?id=1300853435 Jody Treft

    Thank you for this info. Something that needs to be added to the Dictionary section.

  • Marsha

    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?

  • PizzaMan92

    Finaly i start to understand what this word mean !! Thanks for the explanation man :D

  • Gru Jiang

    Thx

  • Sheamarie50

    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.

  • John Minadeo

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

  • pramod

    Well explained mate :) thnx a lot

  • Sushil Kumar

    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

    • Sonuva!-VZW SGS3

      Can’t be done without Root. You can download a custom launcher from Play but that’s it.

  • Karan

    Is removing all odex files is safe?