Remove All Ads from XDA
Honor View 10

 View Poll Results: Which sort of ROM do you have?

Odexed ROM
43 Vote(s)
Deodexed ROM
56 Vote(s)

[Explained] Difference between Odex and Deodex?

412 posts
Thanks Meter: 216
Post Reply Email Thread
Odex versus Deodex

As an Android newbie, what bothered me most was coming across terminology beyond my comprehension. Not coming from a Linux background it became hard to keep up with the oh-so-commonly-used words spread all across the development community. Likewise, since I didn’t understand the terms, consequently I was unable to determine is something was of any use to me or not. From what I have seen, this problem extends to many novice and even average users.

One commonly occurring word when playing with custom ROMs and firmware, and even themes is deodexed and odexed. Most users fail to understand what these terms actually imply, and while developers would boast again and again about their themes and ROMs being deodexed, the average user is left clueless as to what is going on.

What is an .odex file?

In Android file system, applications come in packages with the extension .apk. These application packages, or APKs contain certain .odex files whose supposed function is to save space. These ‘odex’ files are actually 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.

Then comes deodex!

Deodexing is basically repackaging of these APKs in a certain way, such that they are reassembled into classes.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.

In summary, Deodexed ROMs (or APKs) have all their application packages put back together in one place, allowing for 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 this works

For the more geeky amongst us, 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 the OS to learn in advance what applications will be loaded, and thus speeds up the booting process.

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.

Advantages & Disadvantages

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 almost always choose 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, 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 for some reason.

For a casual user, the main implication is in theming possibilities. Themes for android come in APKs too, and if you want to modify any of those, you should always choose a dedoexed custom ROM.

Full credits to the source:

Update: Here's a link to the Universal Odex Script made by MatrixDJ96
The Following 78 Users Say Thank You to brakke97 For This Useful Post: [ View ] Gift brakke97 Ad-Free
8th April 2013, 09:00 PM |#2  
Native7i's Avatar
Senior Member
Flag Kegalla
Thanks Meter: 11
Donate to Me
Thanks mate, You really saved my lot of time.
9th April 2013, 10:08 AM |#3  
Originally Posted by Native7i

Thanks mate, You really saved my lot of time.

You're welcome!
9th April 2013, 01:12 PM |#4  
ddjonko's Avatar
Senior Member
Flag Novi Sad
Thanks Meter: 45
I really wanted to know about that, since people mention it a lot lately, thanks
The Following User Says Thank You to ddjonko For This Useful Post: [ View ] Gift ddjonko Ad-Free
9th April 2013, 01:36 PM |#5  
Account currently disabled
Flag Lucedale
Thanks Meter: 850
Nice write up very proffesional this should be stickied for new users

Sent from my SCH-I500 using Tapatalk 2
The Following User Says Thank You to bbrad For This Useful Post: [ View ] Gift bbrad Ad-Free
5th October 2013, 05:41 PM |#6  
Thanks Meter: 5
Donate to Me
Thanks! helped me alot! very informative.
5th October 2013, 05:45 PM |#7  
MatrixDJ96's Avatar
Senior Member
Flag Genova
Thanks Meter: 2,514
The best explanation
If you want, you can share my universal odex script for all phone in your thread

Sent from my GT-I9100 using xda app-developers app
14th October 2013, 07:33 AM |#8  
Thanks Meter: 2
Thank you. As a newbie, I learned a lot from your explanations.
26th October 2013, 06:52 PM |#9  
Originally Posted by MatrixDJ96

The best explanation
If you want, you can share my universal odex script for all phone in your thread

Sent from my GT-I9100 using xda app-developers app

Hey MatrixDJ96

I've added the link to your script.
5th November 2013, 07:10 AM |#10  
Senior Member
Thanks Meter: 19
Wow, this was a real lifesaver I finally can differentiate
The Following User Says Thank You to badluckclinton For This Useful Post: [ View ] Gift badluckclinton Ad-Free
14th December 2013, 04:11 PM |#11  
Flag Bauchi
Thanks Meter: 2
Thumbs up

nice write up
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes