FORUMS
Remove All Ads from XDA

[GUIDE]【How To DEODEX Stock ROM】[UPDATE 30sept - FIX JELLYBEAN issue]

736 posts
Thanks Meter: 1,630
 
Post Reply Email Thread


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.




Lets Start...
GUIDE TO DEODEX STOCK ROM




Java Development KIT
(Download & Setup Guide)

ANDROID SDK

xUltimateV2.3.3

(only this version is capable with samsung device)
Official Link to xUltimate : POST #5

7-Zip
(32-Bit & 64-Bit)




1.Download android-sdk & extract it.

2.Copy sdk folder & paste it into

Code:
C:\Program Files\Android
3.Change name from SDK to Android.sdk.


(inside folder look like this)
4.you need to flash stock firmware first & Root your device.
5.Connect your phone to computer.(Make sure you have select USB debugging in Settings>Applications>Development)
6.Download & extract xUltimate zip.

7.Launch Main.exe(Run as administrator)

8.If everything goes well xUltimate should recognize the phone and make a connection.You now should see a list of options.

9.Select option (1) pull /system/app. Wait until it complete.
10.Select option (2)pull /system/framework. Wait until it complete.
11..Then select option (3) Deodex /system/app. Wait until it complete.
[If encounter any error. Find out which .odex file is it. Then remove .odex file from folder origi_app in xUltimate folder]
(i found 5 errors so i attached that app's deodex files below you just want to paste in system/app when this process complete)
12.Then select option (4)Deodex /system/framework. Wait until it complete.
13.DONE : your rom is now deodex. Now Exit from xUltimate


Now there are 2 ways to install deodex files in device

1. from Android.SDK

From Android.SDK :

1.Put the phone in USB mass storage.

2.Go to xUltimate folder and copy "done_frame", and "done_app", and move them to the root of the sdcard.

3.Now get out from USB storage mode.

4.Go to
Code:
C:\Program Files\Android\android.sdk
& open command promote there.

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.Now you have deodexed rom.




2. from SampleDEODEX.zip file attached below.


From zip file attached

1.open zip given as archive.
(use 7.zip but DO NOT EXTRACT.)

2.go to system/app folder & paste here all your deodexed apk's

3.same for for system/framework to paste framework files.

4.done, paste it in your SD-Card & flash through CWM.






STILL IF YOU FACE ANY ERROR
Especially Android 4.1 + (JB) users

Try this method Updating xUltimate tool manually.


Quote:
Originally Posted by asm-xda

First of all, thx for the OP. This method for Deoexing works fine, I needed to make a few updates - described below - in order to make it work on my GT-P3113 device, running JB 4.2.2.

OK. So, you have already made sure JDK is properly installed but still can't succeed? Check the following... These are the changes I had to make to deodex my ROM.

1. Get the latest version of xUltimate. It's version 2.4.2: http://www.xeudoxus.com/android/xUltimate-v2.4.2.zip. If you got version 2.3.3 and accepted to download latest version, you were directed to a thread that is not updated with the latest version. Check post #549 on that thread to find the link I've pasted above.

2. If you happen to have Android 4.2.2 on your device, ADB needs to be updated. xUltimate has version 1.0.26 which won't properly connect with your device. NOTE: you can tell which version of adb you are using by running this: adb version
So:

  • Install the latest version of the Android SDK to get ADB version: 1.0.31 (or later, should be fine).
  • Locate and copy over these 3 files from the Adnroid SDK install folder into xUltimate-v2.4.2\jar replacing the existing ones:
    • adb.exe
    • AdbWinApi.dll
    • AdbWinUsbApi.dll

3. I don't know this step is a must for everyone, but it was for me. The assembler/deassembler for .dex file format must be upgraded too. The version in the jar folder in xUltimate-v2.4.2 didn't work fine with the .odex files in my stock ROM.

So:
  • Download smali.jar and baksmali.jar from here: https://code.google.com/p/smali/. I got version 1.4.2 but any above that should work fine too for the latest available ROMs I guess.
  • The 2 files probably include the version number in the filename ( i.e.: smali-1.4.2.jar and baksmali-1.4.2.jar). Rename them so they are called: smali.jar and baksmali.jar.
  • Copy (& replace) those 2 files into xUltimate-v2.4.2\jar folder.

So, that's it. After doing all the above, I managed to deodex my ROM. Well... not quite... there's something else.
After doing the steps above, you should go ahead and follow instructions in the first post of the thread. If everything works, then you are done! Say thanks to OP and enjoy your deodexed ROM.

If however, you still encounter errors while running the xUltimate tool, keep reading...

NOTE: The following is probably only true for certain devices (like mine) so disregard if you don't find any error while following OP steps to deodex.

I got into errors deodexing these files: SamsungIME, SecEmail_Tablet, SecSetting and SecExchange.

Since I couldn't find how to make them work, I decided to leave those files odexed. I'm not sure if that was a good idea or not, but it's fine for me because in my case I actually wanted to deodex some specific apks, not really all of them.

If you decide you want to skip some files (as I did), you'll need to proceed as follows:
  1. Take note of the files that couldn't be deodexed and move those files from the orig_app or orig_frame folder into a new folders, let's call them: "no_deo_app" and "no_deo_frame". Ensure you move the .odex file + .jar file (in case it exists). Make really sure you move files into the right folder: "orig_app" into "no_deo_app" and "orig_frame" into "no_deo_frame".
  2. Run the deodexing again until everything works fine. If you find another file that gives you problem, you do step 1 and 2 again until the tool completes all files successfully.
  3. Now you have 4 folders that are relevant: "done_app", "done_frame", "no_deo_app", "no_deo_frame". Copy all of them into the root of your sdcard.
  4. Now, get into adb shell as superuser access as described in OP following the commands below instead of the ones in the OP. Basically the difference will prevent you from deleting the odex file for the apps that couldn't be deodexed.
    Code:
    adb shell
    su 
    stop
    mount -o rw,remount /system/ /system/
    cp /sdcard/done_app/* /system/app/
    rm /system/app/*.odex
    cp /sdcard/no_deo_app/* /system/app/
    cp /sdcard/done_frame/* /system/framework/
    rm /system/framework/*.odex
    cp /sdcard/no_deo_frame/* /system/framework/
    mount -o ro,remount /system/ /system/
    reboot

Well, that was it for me . This is what I've done to doedex my stock JB 4.2.2 ROM my Galaxy Tab 2 7.0 tablet.

Regards!


thanks to @asm-xda




4real*leb

Xeudoxus

and

asm-xda

(for finding the way to deodex rom for Jellybean User)






GALAXY Ace Plus User's : GO HERE
Attached Files
File Type: zip SampleDEODEX.zip - [Click for QR Code] (138.9 KB, 8146 views)
File Type: apk GoogleQuickSearchBox.apk - [Click for QR Code] (642.8 KB, 942 views)
File Type: apk Phonesky.apk - [Click for QR Code] (5.89 MB, 1313 views)
File Type: apk serviceModeApp.apk - [Click for QR Code] (169.6 KB, 1232 views)
The Following 64 Users Say Thank You to j.posarekar70 For This Useful Post: [ View ] Gift j.posarekar70 Ad-Free
 
 
24th July 2013, 03:50 AM |#2  
omarilzz's Avatar
Senior Member
Flag In your house!!
Thanks Meter: 600
 
Donate to Me
More
Cool
The Following User Says Thank You to omarilzz For This Useful Post: [ View ] Gift omarilzz Ad-Free
24th July 2013, 11:43 AM |#3  
j.posarekar70's Avatar
OP Senior Member
Flag ◢| MUMBAI |◣
Thanks Meter: 1,630
 
More
Quote:
Originally Posted by omarilzz

Cool

Thanks bro
The Following 2 Users Say Thank You to j.posarekar70 For This Useful Post: [ View ] Gift j.posarekar70 Ad-Free
28th July 2013, 01:29 AM |#4  
Member
Thanks Meter: 5
 
More
will this work with any phone?
i have an alcatel OT X'pop. will this work? 4.1.1?
29th July 2013, 02:22 PM |#5  
j.posarekar70's Avatar
OP Senior Member
Flag ◢| MUMBAI |◣
Thanks Meter: 1,630
 
More
Quote:
Originally Posted by aldnnnn

i have an alcatel OT X'pop. will this work? 4.1.1?

YES it does work on any device...
first give a try on above 2.3.3 xUltimate version if u face any issue download latest version v2.4 from here ;


follow same steps like above
The Following 7 Users Say Thank You to j.posarekar70 For This Useful Post: [ View ] Gift j.posarekar70 Ad-Free
31st July 2013, 05:27 PM |#6  
ManzzaShahi's Avatar
Senior Member
Thanks Meter: 107
 
More
Wink
nice method but it is easier from dsixda's kitchen(cygwin)
1st August 2013, 01:02 AM |#7  
Member
Thanks Meter: 5
 
More
cant recognized device
i think ive done everything but still wont recognize my device.
any suggestions?
1st August 2013, 01:49 PM |#8  
j.posarekar70's Avatar
OP Senior Member
Flag ◢| MUMBAI |◣
Thanks Meter: 1,630
 
More
Quote:
Originally Posted by ManzzaShahi

nice method but it is easier from dsixda's kitchen(cygwin)

i know...
but that kitchen doesn't deodex our device's apk files as much this xUltimate do
i don't know why
but i tried every step (I have kitchen & several kind software's too) & found easiest way is this only to deodex ur apk files


Quote:
Originally Posted by aldnnnn

i think ive done everything but still wont recognize my device.
any suggestions?

Give a try on newer version v2.4 I gave link above in that pic.
coz it has ICS Razor support.
or you have to check whether your java works fine or not.

go through some youtube video's to find how to setup JAVA or follow guide below;
The Following User Says Thank You to j.posarekar70 For This Useful Post: [ View ] Gift j.posarekar70 Ad-Free
1st August 2013, 02:26 PM |#9  
j.posarekar70's Avatar
OP Senior Member
Flag ◢| MUMBAI |◣
Thanks Meter: 1,630
 
More
Info JAVA Development KIT

< Guide How to Setup JAVA >

Download JAVA Development Kit & install it first.


go to desktop, right click on
computer > properties >:highfive>Advance system setting> in advance tab environment variables

First : In user variable for ***
click new & type

Code:
variable name : CLASSPATH
variable value : C:\Program Files\Java\jdk1.7.0_21\jre\bin (your java installed path varies on your installed location)


Second : In system variables
click new & type

Code:
variable name : PATHTEXT
variable value : .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC



also check in path is there above java path present or not if not just add it BUT do not remove old codes from line...!!!

The Following 16 Users Say Thank You to j.posarekar70 For This Useful Post: [ View ] Gift j.posarekar70 Ad-Free
1st August 2013, 03:13 PM |#10  
Member
Thanks Meter: 5
 
More
Quote:
Originally Posted by j.posarekar70


< Guide How to Setup JAVA >

Download JAVA Development Kit & install it first.

go to desktop, right click on
computer > properties >:highfive>Advance system setting> in advance tab environment variables

First : In user variable for ***
click new & type

Code:
variable name : CLASSPATH
variable value : C:\Program Files\Java\jdk1.7.0_21\jre\bin (your java installed path varies on your installed location)


Second : In system variables
click new & type

Code:
variable name : PATHTEXT
variable value : .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC


also check in path is there above java path present or not if not just add it BUT do not remove old codes from line...!!!

missed this part of installing java
thanks!
will try again soon because i dont have my phone right now.

also i i have these folders in the same java folder
C:\Program Files\Java\jre6
C:\Program Files\Java\jre7
do i need these files?
1st August 2013, 05:19 PM |#11  
j.posarekar70's Avatar
OP Senior Member
Flag ◢| MUMBAI |◣
Thanks Meter: 1,630
 
More
Quote:
Originally Posted by aldnnnn

missed this part of installing java
thanks!
will try again soon because i dont have my phone right now.

also i i have these folders in the same java folder
C:\Program Files\Java\jre6
C:\Program Files\Java\jre7
do i need these files?

You may keep aside coz u wanna download java development kit which is jdk for that jre doesn't matter...
just for suggestion remove older version of jre from ur pc if u have jre7.
The Following User Says Thank You to j.posarekar70 For This Useful Post: [ View ] Gift j.posarekar70 Ad-Free
Post Reply Subscribe to Thread

Tags
deodex, galaxy ace plus, gt-s7500, how to deodex stock rom, stock deodexed

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

Advanced Search
Display Modes