[Galaxy 3 Android Development] TearsDontFalls:
I made a tutorial for other devices here http://xdaforums.com/showthread.php?t=1500475

Why this tutorial?

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. Im working also on this thread, so I'll try to make few things like a flashable update.zip who executes the script. 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, you have on some roms only 110/170 mb free(because a deodexed rom needs a dalvik cache for system apps and frameworks

-Is not so stable than a odexed rom(because some moves dalvik cache to a low end sdext)

-Slower on first boot(because a odexed rom has already execute ready .odex files, a deodexed rom needs to generate dalvik cache)

Why should I re-odex?

I wanted this, because I use ~100 apps and I have a slow sd card, so moving /data/app and /data/dalvik cache to sdext made my system unstables, which was needed to run ~100 apps on a deodexed rom. But when I tried it on a odexed rom, I had only to move /data/app to sdext. So I used long time Stock rooted JPU. But the system was not so fast than on any other custom rom and I hated the stock theme. So If you want more space on /data and you don't want to try out new themes, you should probably try re-odexing.

What do I need to re-odex?

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

Option 1 using dexopt-wrapper:

I used first the script from puppet13th, but I got into a bootloop. So I corrected the $BOOTCLASSPATH and corrected permissions, but I got also into a bootloop. I compared the re-odexed Kyrillos Rom v9.3 framework with the framework from JPU. The difference was that Kyrillos Rom v9.3 Framework files android.policy.jar and services.jar doesnt contained the Meta-Inf.

Step 1: Check jars

Pull all your framework .jars using this adb command to your computer

adb pull /system/framework

and open them in WinRar or sth and check that they contains the Meta-Inf folder. If some file doesnt contain a Meta-Inf folder, I attached all jars from Stock JPU, so you can add the Meta-Inf folder from them. When you are done with adding Meta-Inf Folder to one file, you can push it to the system using this adb command(services.jar is only for example, use your filename):

adb push services.jar /system/framework

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 2(optional): Reboot your phone into cwm recovery and get adb access there

I never got adb access in windows, but i got always access with linux. If you also don't get access on Linux, you should try to reboot your phone and to select then recovery in the extended power menu, this gaves me always adb access.

Step 3: run reodex script

I attached a script, which push a script and needed binaries over adb to the phone. Then it executes the pushed script, which creates odex files and removes classes.dex from apks or jars and rezipaligns apks and deletes 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

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.

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, not the 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(against Option 1)

For other Phones:

If someone has a other phone, theres a chance for getting re-odex working, but I think that you should not hope that it works. You can try to put in the right $BOOTCLASSPATH. You can find the valid $BOOTCLASSPATH in /init.rc. Then replace the following characters with the $BOOTCLASSPATH in the script in the folder odex(beginning from Line 8):

BOOTCLASSPATH=replace_this_with_your_bootclasspath
cd /system/framework
for filename replace_this_with_your_bootclasspath

In the line

for filename replace_this_with_your_bootclasspath

you must replace the ":" character between framework files with a space.

For theme developers:

I dont know if it works that you use the re-odexed theme on a stock odexed theme. If it is so, you dont have to re-odex and deodex your phone, you can simply push the dexopt-wrapper binary to a folder, chmod 755 it and use it to make odex files from the needed apks and jars(all apks inside /system/framework has no odex files, so dont odex them) like this:

dexopt-wrapper /system/app/Phone.apk /mnt/sdcard/Phone.odex /system/framework/core.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar

You can change argument 1-2, but not argument 3(its the BOOTCLASSPATH)Then you could copy all needed main apks or jars to sdcard and remove classes.dex. Then only do Step 1 from Option 1 and you should have a theme for odexed rom.

Download Links

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

Framework jars from JPU

Re-Odex Script for Windows

Re-Odex Script for Linux

Credits

puppet13th for making orginal script

If I helped you, dont be shy, just press the Thanks Button under this post.