[Captivate Android Development] Liv33viL:
​

How To Deodex Your Device Tutorial

What is odexing?

What is deodexing?

Why you may consider deodexing over odexing.

Disclaimer: This tutorial is meant as a guide for education purposes only. If you decide to take the initiative to perform a deodexing operation on your device a family member’s device or a friend’s device – you (the surgeon) assume all responsibility for you own actions. In other words… Your problems are your own… Read before dissecting!

What is Odexing? – Within the Android Operating System applications come in the form of .APK packages compiled with .odex files that work with the primary application. Odex files are compiled with portions of the main application manifests and hold partial instructions for how this application will boot, how it will run and how it will act within the entire file structure. These odex files hold instruction for an application to pre-boot, pre-launch and how the service (if any) will function. Some assumptions are that the speed of the file system and application will be increased by way of pre launching the application prior to usage. My thoughts on this are that battery usage and memory are also being consumed while you may not even draw on that particular application. Simply put, the Odex file holds a set of functioning instructions for the application it belongs with. Think of it as sort of a pre-buffer and caching at the same time.

What is Deodexing? – Deodexing is the process of removing the child instruction file from the parent file and importing all the information that has been removed from the odex file into the APK. Full freedom to perform on its own without the aid of little odex.

Why may you consider deodexing a file system over having an odexed file structure? – Application modifying can be near impossible with many instructions for a single application existing in various places of the file structure. Consolidating all the functions of an APK in a single location will help to simplify the process.

Are you ready to become deodexed…?

So, get your scalpel ready and let’s begin…

This process will be described working within a Windows environment.

You will need to have a few things in order before we begin:

1)	A Rooted phone – (A Must)

2)	A working Windows workstation or desktop

3)	xUltimate Utility v2.2.1 (see the link from my prior post to download the tool)

http://xdaforums.com/showpost.php?p=12024563&postcount=126

4)	Developers SDK toolkit – or – the ability to run adb commands

5)	A little time to burn

Let’s get started:

1)	Assuming that you have already downloaded xUtility v2.2.1 – unzip the package to a directory you can easily access.

2)	Make sure to put your device in debugging mode and plug the USB cable from the PC into your device.

3)	You can run the Test.exe to verify that the xUtility sees your device, but it’s not necessary and may cause a doubling effect with adb so that your device won’t be seen – so just execute the Main.exe and wait for the device to communicate with the application.

4)	Once your device has been read by the xUtility, answer the questions in the prompts according to your make and model. (You do not need to upgrade to a newer version of xUtility because this is the newer version – regardless of what the application states)

5)	Execute Action 1 then follow the instruction at the prompts

6)	Execute Action 2 then follow the instruction at the prompts

*Note: For any reason the process fails to begin or hangs during the process – verify that there is only one instance of adb running on your PC or this could result in issues.

*Note: If issues occur, you can always perform an adb pull to the origi_app directory (within xUtility) and then the origin_frame directory (within xUtility)

*Note: This could take some time depending on the size of the directories

7) When the migration is complete - perform Action 3 in xUtility - This will perform the deodexing of the application APKs.

8) When the Application Deodexing is complete - perform Action 4 in xUtility - This will perform the deodexing of the framework APKs. (Mainly Java Files)

9) For safety purposes – backup the files in both the origin_app and the origin_frame directories and put them in a safe place just in case.

10) Close the prompt for xUtility – the process should be complete.

11) Exit debugging mode with your device and enter into mass storage mode. You will need to remove the USB cable before performing this, then plug the USB cable back in once the mode shift has occurred.

11) You should now see your device in Windows as a mass storage drive.

12) Go into the xUtility directory and copy the 2 folders named – “done_app” and “done_frame” to the root of your internal SDCard.

13) Get your command prompt open and get ready to type some code

Just my preference - Prior to migration of the deodexed files I chose to wipe the dalvik-cache from my device to ensure no rouge variant cached instructions would be present after the next boot. – You could CWM into the next soft boot and perform a dalvik wipe if you choose.

At The Command Prompt: Code Below:

adb shell

# su

# stop

# mount -o rw,remount -t ext4 /dev/block/mmcblk1p21 /system

# cp /sdcard/done_app/* /system/app/

# cp /sdcard/done_frame/* /system/framework/

# rm /system/app/*.odex

# rm /system/framework/*.odex

# chmod 644 /system/app/*

# chown root.root /system/app/*

# chmod 644 /system/framework/*

# chown root.root /system/framework/*

# mount -o ro,remount -t ext4 /dev/block/mmcblk1p21 /system

# reboot

After your device reboots it will take longer than usual to load the new file settings – so be patient and don’t panic.

You now have a deodexed device!

If you found this tutorial useful and helpful or you just enjoy reading my posts Show your gratitude by hitting that thanks button on this post.

All the best

Peace-

Liv33viL