[Guide] What is Odex and Deodex in Android

What is Odex and Deodex in AndroidIf you are new to the Android world and are happy using your smartphone as,well just a smartphone. You can remain ignorant of some of the terminology associated with the platform. But when you are using an open platform like Android, you will quickly look past the general limitations of smartphone platforms as you start to explore the highly customizable world of Android.

Now if you are someone who has started using custom ROMs, firmware or themes you will likely come across the words deodexed and odexed. So how do you choose which is which?

I decided to put a guide together explaining the differences between odexed and deodexed and hopefully once you are done reading it, you will have a clear idea which is right for you.


Android applications have the .apk extension. These application packages, or APKs contain certain .odex files whose supposed function is to save space. These ‘odex’ files are a collections of parts of an application that are optimized before booting. Doing so speeds up the boot process, as it preloads part of an application. On the other hand, it also makes hacking those applications difficult because a part of the coding has already been extracted to another location before execution.


Deodexing on the other hand repackages these APKs in a certain way, so that they are reassembled intoclasses.dex files. By doing that, all pieces of an application package are put together back in one place, thus eliminating the worry of a modified APK conflicting with some separate odexed parts.

When you ROM (or APK) are Deodexed, they have all their have all their application packages put back together in one place to allow easy modification such as theming. Since no pieces of code are coming from any external location, custom ROMs or APKs are always deodexed to ensure integrity.

How it works

Android OS uses a Java-based virtual machine for running applications, called the Dalvik Virtual Machine. A deodexed, or .dex file contains the cache used by this virtual machine (referred to as Dalvik-cache) for a program, and it is stored inside the APK.

An .odex file, on the other hand, is an optimized version of this same .dex file that is stored next to the APK as opposed to inside it. Android applies this technique by default to all the system applications.

Now, when an Android-based system is booting, the davlik cache for the Davlik VM is built using these.odex files, allowing Android to learn in advance what applications will be loaded, and speeds up the booting process as a result.

By deodexing these APKs, a developer actually puts the .odex files back inside their respective APK packages. Since all code is now contained within the APK itself, it becomes possible to modify any application package without conflicting with the operating system’s execution environment.

Pros & Cons

The advantage of deodexing is in modification possibilities. This is most widely used in custom ROMs and themes. A developer building a custom ROM would always prefer to deodex the ROM package first, since that would not only allow him to modify various APKs, but also leave room for post-install theming.

On the other hand, since the .odex files were supposed to quickly build the dalvik cache and removing them would mean longer initial boot times. However, this is true only for the first ever boot after deodexing, since the cache would still get built over time as applications are used. Longer boot times may only be seen again if the dalvik cache is wiped

Hope this post helps you discover the differences between ODEX and DEODEX... Leave a comment if you have any questions or comments.

Post a Comment