For us who like to modding our Android device must be often hear about "ODEX" and "deODEXed". So what is that things? And why there must be two DEX type? Actually this is myself question :v .
Quoted from stackoverflow.com:
Applications are basically glorified ZIP archives. The java code is stored in a file called classes.dex and this file is parsed by the Dalvik JVM and a cache of the processed classes.dex file is stored in the phone's Dalvik cache.
An odex is basically a pre-processed version of an application's classes.dex that is execution-ready for Dalvik. When an application is odexed, the classes.dex is removed from the APK archive and it does not write anything to the Dalvik cache. An application that is not odexed ends up with 2 copies of the classes.dex file - the packaged one in the APK, and the processed one in the Dalvik cache. It also takes a little longer to launch the first time since Dalvik has to extract and process the classes.dex file.
If you are building or choosing a custom ROM, it's a really good idea to odex both your framework JAR files and the stock apps in order to maximize the internal storage space for user-installed apps. If you want to theming it, then simply deodex -> apply your theme -> reodex -> release.
DEX stands for "Dalvik EXecutable", so ODEX will be " Optimized Dalvik EXecutable". As it says, ODEX is an optimized one from the app apk dex file so the system will more easier and faster to read and execute the application information.
The way to know which one our ROM classified to is pretty simple, just use an application that can explore the root directory (like ES File Explorer or Root explorer), and go to directory /system/app. If we found inside the directory two same application name with different extension (example: gmail.apk and gmail.odex) so our Android ROM is on ODEX. If not found any odex file inside the directory, then our ROM must be deODEXed.
ODEX on Android
ODEX ROM oftenly we will find it on stock ROM, the default ROM that created by device manufacturer. ODEX ROM will save more phone storage (internal memory) because the system apk app DEX (ODEX) files will moved to /system
ODEX ROM has advantages:
- More safe and stable, because not easy to be changed / modified
- More free space on internal memory
deODEXed on Android
Different with another one, deODEXed ROM will oftenly be found on stock ROM (3rd party created ROM). Say for ROMs for my Samsung Galaxy V, the developers of the custom ROMs make its all deODEXed (except CM11). It will use more space on internal memory, but saves more on system storage.
deODEXed ROM has advantages:
- Easier to mod / theming it (it's good for you who like to change the theme like icon, systemUI, colors, etc)
- More free space on /system directory.
How about speed and RAM problem
From what i read, many says that ODEX ROM is faster than deODEXed, moreover from booting time. But from what i feel in my Samsung Galaxy V Android, the two is just the same. It is true need a longer booting time in a deODEXed ROM, but it just happen one time when the ROM is first booting (just after i install the deODEXed custom ROM)
If see from RAM problem, yes i feel the ODEX ROM has more empty RAM space. But the different is not very great, maybe the RAM is just 10% more empty from deODEXed one. Because the RAM or speed is basically up to the user how he treat his Android device and the size of application that installed on the device.