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.
More information is available here.
Odexing your ROM
Deodexing your ROM
Preparing for (de)odex operations
- Install ADB on your PC (yes a PC is required for recovery)
- Enable USB debugging in developper settings
- Connect and make sure your device is recognized and you know the basics of using ADB.
- Make a copy of those 3 folders: /system/app, /system/priv-app (if it exists) and /system/framework, preferably on your device SD card(s).
Recovering from issues
- Connect device to your PC, and run 'adb shell' in a command window or terminal
- Type 'su' to switch to root user, your device might ask you to grant root to adbshell, just confirm.
- Move to your backup copy of the 3 folders (for example cd /sdcard/my_backup)
- Copy failing apps or entire directories (for example cp -r ./system/app/* /system/app)
- Reset permissions on restored directory (for example chmod -R 644 /system/app/* or chmod -R 644 /system/framework/*)
- Restore context (if running Lollipop or above) on restored directory (for example restorecon -R /system/app/*)
- Run this command 'rm /data/dalvik-cache/*' (WARNING: makes no mistakes with this as it could make things worse)
- Reboot your device, either manually or typing 'reboot'.
- Log in to post comments