Odexed vs. Deodexed

Deodexed vs Odexed – The Important Differences Explained.

Before I go into explaining the difference between deodexed and odexed, let’s first make sure you understand the common file format definitions.  If you want the simple answer, see the summary in this post.

Related Vocab

term definition
.dex Android programs are compiled into .dex (Dalvik Executable) files, which are in turn zipped into a single.apk file on the device. .dex files can be created by automatically translating compiled applications written in the Java programming language.
.odex An .odex file is an Optimized .dex file, which is basically a pre-compiled app for a specific device platform.  A .odex is essentially a .dex that has been optimized by dexopt.
.apk Android application package file (APK) is the file format used to distribute and install application software and middleware onto Google's Android operating system; very similar to an MSI package in Windows or a Deb package in Debian-based operating systems like Ubuntu. To make an APK file, a program for Android is first compiled, and then all of its parts are packaged into one file. An APK file contains all of that program's code (such as .dex files), resources, assets, certificates, and manifest file. As is the case with many file formats, APK files can have any name needed, provided that the file name ends in .apk.
zipalign An archive alignment tool that provides important optimization to Android application (.apk) files.  Full definition and usage: zipalign | Android Developers

Odexed and Deodexed

A standard ROM is supposed to be odexed for release which provides smoother and faster loading of apps into memory.  Each .apk has a corresponding .odex.  When the application is used by either the system or the user, the .odex is used to start loading the app.  A ROM that is deodexed has only the .apk file.  When the application is called into memory from only pulling the data from it’s .apk, this takes longer due to not being optimized for easier retrieval from the system.

Common questions that I get asked way too often are:

  1. Why do custom ROM’s deodexed?
  2. Should I use a odexed or a deodexed ROM?

To answer these questions it comes down to one word, themability.  If you talk to anyone that themes ROM’s they will tell you that it’s extremely easier to theme a deodexed ROM.  Since we started using deodexed ROM’s, themers could now create themes to apply to a ROM rather than the tedious option to theme the ROM itself (release a custom ROM for a theme).  If you use a odexed ROM and try to apply themes, it will not work or only theme some visual aspects, which will give you a terrible user interface to experience.

Deodex Cons

I bet you are now wondering why… why is there even an option to download a custom ROM that is odexed?  The answer to that is speed.  Remember how I said that odexed files are optimized for easier retrieval?  Simply put… it’s optimized (like indexing a data table) so the system can open the .apk faster.

Deodex and zipalign

Everyone wanted the best of both worlds so quickly after the deodexed trend started to peak, these savvy ROM developers came up with a solution to zipalign at boot.  This optimizes each .apk on every reboot which then allows the system to access applications more efficiently and most importantly, faster.  Of course, the disadvantage is slightly slower boot times.

Summary

If you have a choice to download the custom ROM odexed or deodexed, I would just go with the deodex ROM.  You never know when you would want to try out a theme or do some modifications yourself and it’s nice to have easy options rather than flashing a whole new ROM.  With newer devices you may not even see a noticeable difference to zipalign on boot.  If your device is pretty slow and outdated, well then I would suggest to think about this a little harder.  I would bet some of you would prefer to get a nice minimal optimized (odexed) ROM for better performance and speed over customizing the user interface.

  • Nathan Brown

    What about the apps. Can you deodex a stock app so you can install it on a custom rom

    • http://google.com/+derekross Derek Ross

      Yes. Yes you can.

      • Nathan Brown

        Cool. (tried on my galaxy tab 2. didn’t work, i’m guessing it does not work on Touchwiz apps as it needs touchwiz)

  • http://urban-man.com Frank Moolah

    Thanks for the explanation

  • Curtis

    Great explanation thanks a lot!