This guide is for all who wants to deodex their roms for easy customization.
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.
What is an DEODEX file?
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.
So, 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 majority noobs amongst us, Android OS uses a Java-based virtual machine 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.
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.
Advanteges & 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.
Note: Themes for android come in APKs too, and if you want to modify any of those, you should always choose a dedoexed custom ROM.
Now Lets Start!!!
1. Java installed on your PC
2. Universal Deodexer (Download from here - http://d-h.st/bMp)
3. Android SDK (for installing deodexed files)
1. Now first of all you need to copy system/framework and system/apps folders from your phone to your PC. You can do this by simply using the Root Explorer or using ADB commands.
2. Download and extract the zip. You will get a folder called "Universal Deodexer V4"
3. Open the folder and place all your apks or jars from the apps folder in the "apks" folder. No need to manually check if a apk has the corresponding .odex file or not. Apks or Jars which do not have .odex files are automatically deleted.
4. Double click on Universal Deodexer V4.jar. If it does not open then right click--->Properties--->change the Opens With: to "Java(TM) Platform SE Binary". Now double click and it will open. If it still doesn't open then shift+right click anywhere in the folder and open a command prompt window there. Then type - "java -jar Universal Deodexer V4.jar" (no quotes) and see the output.
5. Select the various options (android version, compression level, debug mode).
6. Then chose the deodex all apks option. Once the deodex is complete, you will get a popup message if it was successful or not.
7. You can find the deodexed apks in the "deodexed" folder. Copy them to some other folder and empty the "apks" and "deodexed" folder.
8. Now for framewok files, you also need to put them in the "apks" folder not in "framework" folder (because there is a bug in this tool).
9. Then you need to choose both the options deodex all apks and deodex all jars one by one.
10. Thats it... Done
Now for installing deoedexed files in your phone:-
1. Put the phone in USB mass storage.
2. Go to folder where you have copied Deodexed apks and framework files and move them to the root of the sdcard.
3. Now get out from USB storage mode.
4. Go to the folder there you android SDK is installed. Go to C:\Program Files\Android\android-sdk\ [Assuming that your SDK is installed in C:\]. Then open a command prompt here. For this press Right Mouse click while holding the Shift key and select the "Open command window here" option.
5.Enter following codes.
(If you are using ADB shell in su for the first time, keep phone screen on. After entering "su" code, super user request prompt in phone. Press allow )
adb shell su stop mount -o rw,remount /system/ /system/ cp /sdcard/done_app/* /system/app/ rm /system/app/*.odex cp /sdcard/done_frame/* /system/framework/ rm /system/framework/*.odex mount -o ro,remount /system/ /system/ reboot