Happening now! New Honor Phone Launch
FORUMS
Remove All Ads from XDA

[How-To] Re-Odex a Rom

282 posts
Thanks Meter: 138
 
By TearsDontFalls, Senior Member on 16th February 2012, 02:06 PM
Post Reply Email Thread
Why this tutorial?

I made this tutorial for the galaxy 3, but then some user reported me that it worked on another phone, so I post this thread here again.

I wanted a good odexed rom, but there isn't any here. So I tried to make my own odexed rom, but it wasn't so good. So I read something about re-odexing and tried it out. I modified it a little bit and I don't know all about re-odexing, so if someone know something better, pls post it here in the thread for everyone. English is also not my mother language, but I hope you'll understand me

What is a odexed and a deodexed rom?

When you look at a stock rom in the folder /system/app, you will see files with the ending .odex and the apks doesn't contains classes.dex files. When you look at a deodexed rom, you'll see that there are no .odex files and the apks contains classes.dex files. Basically every apk contains a classes.dex files. Then the dalvik virtual machine generates a dalvik cache based of the classes.dex file. When you load a app, it will be loaded from the the dalvik cache, not from the apk. Samsung built the odexed rom using a tool called dexopt-wrapper. This tool generates .odex files based from the classes.dex, that means it does the same job like the dalvik vm. The .odex files were pushed in the /system. The files are the replacement for the dalvik cache. Like I wrote above, apps are loading from the dalvik cache, not from apk or classes.dex file, so classes.dex are not needed anymore, so they are deleted in odexed roms. Deodexing using xUltimate means regenerating a classes.dex based from the .odex file, merging it into the apk and deleting .odex.

What are the advantages and disadvantages from a deodexed rom?

Advantages:
-All needed things are in one apk, so modding/theming is (better) possible
-Needs less space on /system
Disavantages:
-Needs more space on /data
-Is not so stable than a odexed rom
-Slower on first boot(because a odexed rom has already execute ready .odex files, a deodexed rom needs to generate dalvik cache)


What do I need to re-odex?

-A rooted phone
-A full NANDroid Backup
-More than 30 mb free space on /system
-ADB drivers for Option 1
-Titanium Backup Pro for Option 2

How can I re-odex a Rom?

There are 2 Options to do it, but only the first does a full re-odex.

Before doing anything make sure that you have a full NANDroid Backup because you'll propably get into a bootloop and I cant guarantee that it works on your device/rom.

Option 1 using dexopt-wrapper:

I used first the script from puppet13th, but I got into a bootloop. So Ive done some changes and tried it until it worked

Some users told me that you can re-odex the rom without being in CWM, so you can may skip Step 2, but you could get into a bootloop without Step 2, but you can try it out, there is no risk with a NANDroid backup

Step 1: Configure the script for your device:
The attached script is made for the galaxy 3, so you have to configure the script for your device. If you done it, pls upload it and post it here for other users.
Download the zip(link below) for your system and unzip it. Then go to the folder "odex" and then open there the file/script "odex" with your favourite text editor(I suggest Notepad++).
You only have to replace the $BOOTCLASSPATH. You can find the valid $BOOTCLASSPATH in /init.rc. Enter your $BOOTCLASSPATH after "BOOTCLASSPATH=" for example so(beginning from Line 8):
Code:
BOOTCLASSPATH=replace_this_with_your_bootclasspath
cd /system/framework
for filename replace_this_with_your_bootclasspath
In the line
Code:
for filename replace_this_with_your_bootclasspath
you must replace the ":" character between framework files with a space.

Step 2(optional): Reboot your phone into cwm recovery and get adb access there
For best results you should re-odex in the recovery menu. Some users told me that it also works in a running system, so you can also try it in a running system, but you must mount /system rw before.
So if you want to re-odex in the recovery menu, reboot into recovery and make sure you have adb access.

Step 3: Ensure /system & /data is mounted, Connect your phone and run reodex script
Make sure that /system and /data is mounted in rw mode(in recovery: go to mount & storages, in a running system:use root explorer) and connect your phone with your computer.
You already downloaded the re-odex script in step 1. Your computer will push it over adb with the needed binaries to your phone. The script will create odex files, will delete classe.dex from the apk/jar, will rezipalign your apks and will delete the dalvik cache.
For windows users: double click on odex.cmd
For linux users: open a terminal and navigate to the folder which contains the unzipped attachment and run
Code:
chmod +x reodex.sh
./reodex.sh

After its finished, simply reboot and enjoy your fully re-odexed rom.

Step 4 (optional) convert /data:
I dont know if there is a better option, but after a re-odex with Option 1, my phone didnt showed the right free space on /data. So I converted /data to a other filesystem and back and then it showed the right free space.
So check your free space and if its wrong, convert your filesystem if you kernel support that.

Option 2 using Titanium Backup Pro:

You need to have Titanium Backup pro for re-odexing.

Step 1:
Select Menu -> More -> integrate sys dalvik into rom and wait until its finished. Then you should have more space on /data. I had when I tried it before 105 and after 135 mb free space on /data and 0kb free space after it on /system, so its not all.

You can also undo it. Its good when you want to try out a new theme, so you can undo and redo it using TB Pro.
Simply select Menu -> More -> Undo sys dalvik integration
and you're done.


Option 1 vs. Option 2


-Option 1 does a full re-odex, you have full free space on /data(Option 2 does only re-odex the apps in /system/app, not the framework(/system/framework)
-Option 1 deletes classes.dex from apks and jars(against Option 2), so you have more space free on /system
-You can undo Option 2 fast, so theming/modding is also possible by undo, theme and redo it, you can also undo Option 1, its called deodexing, but its not so fast

Download Links

XDA gaves me only 500 Errors when uploading was done, so I uploaded it to min.us

Re-Odex Script for Windows
Re-Odex Script for Linux(probably doesnt work, I cant reupload because I dont have the file anymore)


Working on...

There are only phones in the list, which were reported as working by users. It can aso work on a phone which isnt in the list.
  • Samsung Galaxy 3(working with default script)
  • HTC Amaze 4G(no script attached)
  • HTC Evo 4G(script here)
  • Samsung Galaxy S2(script here)
  • Motorola Atrix(script here)
  • Nexus S (4G)(script here)
  • XPeria Ray(script here)
  • SGS 1 maybe(working script for ICS aokp here and a working script for 2.3.6 (XWJW5) here)
  • Wildfire S(script here)
  • Nexus 7(script here)
  • TF700T & TF300T(script here)
  • Xperia Ray GB REPACK4PDA_V7(script here)
  • Acer A510 and Asus Transformer Prime TF201(script here)

Credits


If I helped you, you can press the thanks button under the post.
The Following 74 Users Say Thank You to TearsDontFalls For This Useful Post: [ View ] Gift TearsDontFalls Ad-Free
 
 
26th February 2012, 08:22 PM |#2  
swagstr's Avatar
Senior Member
Flag Corvallis, OR
Thanks Meter: 1,924
 
More
Thanks very much! I can confirm this works on the HTC EVO 4G. I have attached my odex file. I had to upload it as a ".txt" file, be sure to remove the ".txt" from the "odex.txt" before using
Attached Files
File Type: txt odex.txt - [Click for QR Code] (3.1 KB, 1286 views)
The Following 6 Users Say Thank You to swagstr For This Useful Post: [ View ] Gift swagstr Ad-Free
1st March 2012, 08:59 AM |#3  
danlivesey's Avatar
Senior Member
Flag blackburn
Thanks Meter: 127
 
More
Thanks, I will have a look and try this on my xperia play

Sent from my R800i using xda premium
4th March 2012, 12:15 AM |#4  
Notorious544d's Avatar
Senior Member
Flag London
Thanks Meter: 2,384
 
Donate to Me
More
Thanks a lot. This works on the Atrix.

Odex file attached.
Attached Files
File Type: zip odex.zip - [Click for QR Code] (2.8 KB, 528 views)
The Following User Says Thank You to Notorious544d For This Useful Post: [ View ] Gift Notorious544d Ad-Free
4th March 2012, 03:25 PM |#5  
Mirko ddd's Avatar
Recognized Developer
Flag Piazza Armerina
Thanks Meter: 4,740
 
Donate to Me
More
working on Galaxy S II

edited odex file in attachments
Attached Files
File Type: rar odex.rar - [Click for QR Code] (688 Bytes, 607 views)
The Following User Says Thank You to Mirko ddd For This Useful Post: [ View ]
18th March 2012, 09:00 AM |#6  
Account currently disabled
Flag Los Angeles
Thanks Meter: 202
 
More
Yup mines work on the evo 4G too thanks. Now I have a odex rom. would post the file but swagstr beat me to it. same path as mine.
18th March 2012, 11:06 AM |#7  
OP Senior Member
Thanks Meter: 138
 
More
Nice to see that it's worked without problems on all devices, which tried by users. If I forgot to mention: a g3 rom developer asked me, if he is allowed to publish a rom which was reodexed with my script.
And yes all secs are allowed to publish rom's which are reodexed with my script. You must not add me to the credits, but it would be great if you do it.
The Following User Says Thank You to TearsDontFalls For This Useful Post: [ View ] Gift TearsDontFalls Ad-Free
18th March 2012, 08:44 PM |#8  
swagstr's Avatar
Senior Member
Flag Corvallis, OR
Thanks Meter: 1,924
 
More
Anyway to individually re-odex .apks with this mod?
26th March 2012, 02:54 PM |#9  
OP Senior Member
Thanks Meter: 138
 
More
Quote:
Originally Posted by swagstr

Anyway to individually re-odex .apks with this mod?

Yes, in my reodex package is a folder odex, theres a binary "dexopt-wrapper": copy this to your phone and give it executeable rights and then run over adb or term-emulator:
Code:
dexopt-wrapper <input.apk> <output.odex> <$BOOTCLASSPATH>
The Following 2 Users Say Thank You to TearsDontFalls For This Useful Post: [ View ] Gift TearsDontFalls Ad-Free
27th March 2012, 11:20 PM |#10  
mpiekp's Avatar
Senior Member
Thanks Meter: 622
 
More
Working on Sony neo v so should work on Xperia 2011 range
Attached Files
File Type: zip odex.zip - [Click for QR Code] (698 Bytes, 179 views)
The Following User Says Thank You to mpiekp For This Useful Post: [ View ] Gift mpiekp Ad-Free
28th March 2012, 03:57 AM |#11  
jr_718's Avatar
Senior Member
Thanks Meter: 805
 
More
Reserved

Sent from my SGH-T989 using xda premium
Post Reply Subscribe to Thread

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

Advanced Search
Display Modes