What is Android doing when it says “optimizing apps” after a system upgrade?

Android FAQ: What is Android doing when it says “optimizing apps” after an Android system upgrade (and reboot)?

Short answer

The short story is that Android is doing what it says, creating an optimized version of each app for the new version of Android you just upgraded to. This process makes each app start as fast as possible with the new Android version.

Long answer: Android APK files and odex files

The longer story is that when an application is added to your Android device, an APK (Application Package Kit) file is added to your Android system, but, it’s not actually stored that way. It’s converted to something called an “odex” file. The Wikipedia link shown below states that “dex” stands for Dalvik EXecutable, and “odex” stands for Optimized Dalvik EXecutable.

addictivetips.com gives an explanation of the process:

“In Android, applications come in packages with the extension .apk. These application packages, or APKs contain certain .odex files whose supposed function is to save space. These ‘odex’ files are actually collections of parts of an application that are optimized before booting. Doing so speeds up the boot process, as it preloads part of an application.”

There is a little more description of this process here on Quora. On that page, Ridhish Guhan describes it like this:

“The Android OS does not store apps as-is after installation (i.e., one single APK file). An optimized version of the app is stored in the Dalvik cache — called the odex file.”

Muhammed Ebrar Erdem further explains it like this:

“While it says ‘optimising,’ operating systems generates ‘odex’ files for your apps from scratch. As a simple explanation, odex files can faster the booting time and launching time for apps.”

This StackOverflow post adds:

“Android applications are basically glorified ZIP archives. The Java code is stored in a file called classes.dex and this file is parsed by the Dalvik JVM and a cache of the processed classes.dex file is stored in the phone’s Dalvik cache. An odex is basically a pre-processed version of an application’s classes.dex that is execution-ready for Dalvik.”

Resources

You can also find some more detailed information at these links:

In summary, if you wanted to know what Android is doing when it says “optimizing apps” after performing an Android system upgrade, I hope this is helpful.