Performing (de)odex operations

WARNING: This feature is provided as-is and I will not take any responsibility should anything bad happen to your device. These operations cannot be reverted with a full device wipe, only a restore of the original firmware, please make sure to have a backup ready!

NB: It is best to perform this on a PC because those operations are complex and are best achieved on high performance PC, as explained here.

If your device no longer boot after these operations, you will have to restore the system partition by any means necessary. If one or more app(s) keep crashing, you will have to clear their data at best or restore system partition.

Every Android device comes either odex'ed or deodex'ed. Odex stands for optimized-DEX and represents the instructions that runs on the device. Every app is delivered with a DEX file code which must be optimized before the code actually runs on the device.

Odex'ing a ROM is the action of optimizing system apps and framework creating the odex (optimized-DEX) files in advance.

Odexed ROM are supposed to run faster.

Odexed ROM do not support direct theming and customization.

A rooted odexed ROM can use Xposed to achieve customization and theming.

Deodex'ing a ROM is the action of removing all optimized-DEX files on the system.

Deodexed ROM are supposed to run slower, app code is optimized on first app start.

Deodexed ROM can be customized and themed easily.

A rooted deodexed ROM can use Xposed to achieve further customization and theming.

See below for a way to backup/restore your files if something goes wrong. Most device comes odexed. WARNING:If you don't know what this is and if it is useful to you, just don't do it.The process can be very long and may even cause issues.

Odexing your ROM

You can odex system apps stored in /system/app, /system/priv-app (Android 4.4+) and /system/framework. Optionally it can remove the original classes.dex from the apps and zip-align the APK for faster loading. On the following device restart, the OS might optimize apps. If it persists upon the following restart, it might be necessary to remove the classes.dex from all apps.

NB: While removing the original classes.dex is safer, reverting it is extremely slow and may cause all system apps signature to be updated, which can create unknown issues.

Deodexing your ROM

You can deodex system apps stored in /system/app, /system/priv-app (Android 4.4+) and /system/framework. Optionally it can rebuild the classes.dex and add it back to the apps.

WARNING: Rebuilding the classes.dex is extremely slow (several hours for the whole ROM!) and may change the signature of affected apps which can create unknown issues.

Preparing for (de)odex operations

Before you start a (de)odex operation, we suggest follow those 2 steps: