Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,768,289 Members 46,308 Now Online
XDA Developers Android and Mobile Development Forum

[Guide] [Tutorial] How to Deodex Stock Rom using Universal Deodexer (Easiest Way)

Tip us?
 
divyamg28
Old
(Last edited by divyamg28; 7th February 2014 at 04:41 PM.)
#1  
divyamg28's Avatar
Member - OP
Thanks Meter 15
Posts: 59
Join Date: Aug 2013
Smile [Guide] [Tutorial] How to Deodex Stock Rom using Universal Deodexer (Easiest Way)

Hello Friends..!!!
This guide is for all who wants to deodex their roms for easy customization.

First Lets know some Basic knowledge about DEODEX/ODEX...

 
What is Odex and Deodex ROM

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!!!

Requirements:-

1. Java installed on your PC

2. Universal Deodexer (Download from here - http://d-h.st/bMp)

3. Android SDK (for installing deodexed files)


Instructions:-

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 )

Code:
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
6. Congrats...!!! Now you have deodexed rom
.
.
.
Its Good to THANKS if someone has helped you..!!! You can do by simply pressing the THANKS button
The Following 8 Users Say Thank You to divyamg28 For This Useful Post: [ Click to Expand ]
 
buinghia98
Old
#2  
buinghia98's Avatar
Senior Member
Thanks Meter 23
Posts: 167
Join Date: Jan 2014
Location: Thai Nguyen
Does this need unlocked bootloader?
 
gusato
Old
#3  
gusato's Avatar
Member
Thanks Meter 18
Posts: 77
Join Date: Jun 2014
Location: Nagaland

 
DONATE TO ME
Unhappy ADB shell not working

Quote:
Originally Posted by divyamg28 View Post
Hello Friends..!!!
This guide is for all who wants to deodex their roms for easy customization.

First Lets know some Basic knowledge about DEODEX/ODEX...

 
What is Odex and Deodex ROM

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!!!

Requirements:-

1. Java installed on your PC

2. Universal Deodexer (Download from here - http://d-h.st/bMp)

3. Android SDK (for installing deodexed files)


Instructions:-

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 )

Code:
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
6. Congrats...!!! Now you have deodexed rom
As per the above guide, i was able to deodex all system apk/framework. Then i have copied the deodexed apk and framework folder to the root of the sdcard as said above but at the time of running adb shell, all commands were accepted and except "cp /sdcard/done_app/* /system/app/", it says "cp: /sdcard/done_app/*: No such file or directories. By this, what does it mean, i don't know as it is available on sdcard and i can access it through root explorer. I am totally stuck here, kindly help me to get out of this ...
 
gusato
Old
#4  
gusato's Avatar
Member
Thanks Meter 18
Posts: 77
Join Date: Jun 2014
Location: Nagaland

 
DONATE TO ME
Unhappy Problem using adb shell

[/INDENT][/INDENT][/INDENT][/INDENT][/INDENT]
Quote:
Originally Posted by gusato View Post
As per the above guide, i was able to deodex all system apk/framework. Then i have copied the deodexed apk and framework folder to the root of the sdcard as said above but at the time of running adb shell, all commands were accepted and except "cp /sdcard/done_app/* /system/app/", it says "cp: /sdcard/done_app/*: No such file or directories. By this, what does it mean, i don't know as it is available on sdcard and i can access it through root explorer. I am totally stuck here, kindly help me to get out of this ...
Thanks for your advice but i think you didn't get my point, i have done all the process of deodexing apk n jar file successfully. Then i tried to push them bach into my fone with adb shell and it didn't work. Using adb shell when i entered
"cp /sdcard/done_app/* /system/app/" it says No such file or directory but when entered
"cp /sdcard/done_frame/* /system/framework/" it accept. Why this used to happen????????
 
Nihal George
Old
#5  
Nihal George's Avatar
Junior Member
Thanks Meter 1
Posts: 8
Join Date: Jun 2013
Location: Bangalore
Thank you so much !! This Worked really well on my Micromax a25
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes