Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are ODEX files in Android?

After some android apps installed, I found that it will change to odex file (not apk) in smartphone. How does it happens? Who can teach me, I am very interested about it.

like image 954
user1253435 Avatar asked Mar 06 '12 23:03

user1253435


People also ask

Where are odex files stored?

Its normally located in the Secure file system under apps,each app with have its icon and the odex file with the same name .

What does odex this app mean?

Stock Android implements an odex file structure, with odex meaning “optimized” dalvik executable file. As your likely aware, Android apps on your device are packaged as . apk files. That all being said, what this means is that for pretty much all of your apks there is a corresponding odex file.

What is odex odex tampering?

odex files, allowing the OS to learn in advance what applications will be loaded, and thus speeds up the booting process. By deodexing these APKs, a developer actually puts the . odex files back inside their respective APK packages.


1 Answers

The blog article is mostly right, but not complete. To have a full understanding of what an odex file does, you have to understand a little about how application files (APK) work.

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. When an application is odexed, the classes.dex is removed from the APK archive and it does not write anything to the Dalvik cache. An application that is not odexed ends up with 2 copies of the classes.dex file--the packaged one in the APK, and the processed one in the Dalvik cache. It also takes a little longer to launch the first time since Dalvik has to extract and process the classes.dex file.

If you are building a custom ROM, it's a really good idea to odex both your framework JAR files and the stock apps in order to maximize the internal storage space for user-installed apps. If you want to theme, then simply deodex -> apply your theme -> reodex -> release.

To actually deodex, use small and baksmali:

https://github.com/JesusFreke/smali/wiki/DeodexInstructions

like image 90
Nathan Strong Avatar answered Oct 01 '22 20:10

Nathan Strong