[HTC Amaze 4G] ericdjobs:
Wanted to share this with fellow amaze users. It's a collection of scripts/binaries that will seamlessly reodex your /system/app and /system/framework folders. This will give you a noticeable increased in overall speed/fluidity, boot times, ram usage... I generally prefer to re-odex anything I use. Major downside to re-odexing is that you can't easily modify the APK. But honestly, it's not that difficult to simply deodex the APK in question, mod/theme it, then reodex it. I find the benefits are well worth it.

The original script was created by tommytomatoe. All credit goes to him for the actual creation of this script. I simply made a windows batch file to ease the setup and execution of said script.

Please PLEASE PLEASE make a NANDROID backup before you run this. I've never had it mess anything up, but who knows... just back up and be safe!..

ZIP is attached below. Unzip into any directory (make sure the files stay together) and run Dexo.bat - You MUST HAVE BUSYBOX, WORKING ADB (Wireless ADB support is built into the batch file), and ROOT!

I originally had a quick batch file made for just myself.. but I changed things around and made it a bit more user friendly and other things.... I've only tested it ONCE on my own device once (the modified one).. so just be warned.. and make a backup first!

The batch file will not close on its own, when it's done the device will reboot on its own. You can simply just close the window.

Hope this helps some people! Good luck.

--------------------

[What is Odex?]

During the build process, Android can be built with the flag “WITH_DEXPREOPT=true”. This means that the dex files are preoptimized in the build environment using a dalvikVM on the host, as opposed to optimized during boot on the device. The dex-preopt process results in two files per apk or jar – the jar/apk file and its accompanying .odex file.

----------------------

[What is so tricky about reodexing?]

Due to the nature of the dalvik VM (according to documentation in AOSP), the VM expects the optimization process to follow the strict BOOTCLASSPATH.

/* There are some fragile aspects around bootclasspath entries, owing

* largely to the VM's history of working on whenever it thought it needed

* instead of strictly doing what it was told. If optimizing bootclasspath

* entries, always do them in the order in which they appear in the path.

*/

So that is the dex-preopt during the build time. All the vendors ship devices with Odex, ie, stock ROMs are odex. What about ROMs that have been deodexed? Or how do you go about editing the smali code from the odex files? Thank goodness for JesusFreke, we have baksmali and smali. Using the two in sequence, one can successfully convert the optimized dalvik executable (odex) and dissemble it into a human readable (sorta) language called “smali”, created by JesusFreke and resembles the Jasmin language. Anyways, carrying on. Using the dexopt-wrapper binary, you can re-odex your ROM after it has been deodexed. This sounds pretty simple but as stated above, the VM expects the optimization to follow the BOOTCLASSPATH. You cannot silly nilly deodex android.policy.jar and then re-odex it. Your device will not boot. You must transfer the original “signature” from the original odex file to the newly created (Hint, dd if=original.odex of=new.odex bs=1 count=20 skip=52 seek=52 conv=notrunc). This can be done on a Linux machine or with the busybox binary.

OK. So what is this tool? I just wanted to give a brief (or not so brief) overview of the process. This tool doesn’t deal with partially odexed ROMs. This tool is for odexing a ROM that is completely DEODEX.

The benefits? Faster boot, smaller imprint on /data/ partition, overall faster feeling. The phone will generally just run a little bit faster, system apps will launch quicker..

The myths? I can’t theme ODEX! WRONG! You can theme odex just fine! Just use baksmali and smali.

This requires BUSYBOX.

This requires ADB.

Again HUGE THANKS to tommytomatoe for the original script and his original efforts.

THIS ZIP FILE IS NOT FLASHED IN RECOVERY! You simply extract it to a folder on your hard drive. Then run Dexo.bat, follow on screen instructions. Make sure to nandroid as well as having phone plugged in VIA USB with debugging enabled, or have wireless ADB ready to go.. batch file supports wireless. Just have to follow prompts and enter IP.