top of page
Search
jessyelunday2117x7

Odex to Deodex: The Benefits of Merging .apk and .odex Files



An .odex file is an Optimized .dex file (hence the 'o'), meaning that it has basically been pre-compiled for a specific platform. The advantage to this is that startup time is much faster since the VM doesn't have to perform any optimizing at startup/runtime. The disadvantages are 1) That it takes up some extra space and 2) An odexed app won't run properly if it's put onto another device, and it must have the associated .odex file to run at all.




Odex to Deodex



ROMs are typically released in deodexed form because they can be themed and modified fairly easily, whereas theming/modifying an odexed ROM is basically impossible (at best things would crash like crazy). Some people also choose to release their ROMs in odexed versions for people who would prefer the performance gains.


Most of the stock ROMs I've seen are odexed, I assume because the carriers/manufacturers want the performance boost. They also don't have any kind of official theming methods, so they probably don't care if you can't change the colors of your status icons or your system text or whatnot. Plus they have the advantage of knowing what device they want their system to run on, so they can pre-compile the .odex files very easily, I imagine. As an added bonus, it makes it difficult to pull .apk files off of the device and share them with people.


Edit: Since I just realized that I was not very explicit about the difference here - an "odexed" ROM is one where the apps have been precompiled, and thus contain associated .odex files which are external to the .apk files. A "deodexed" ROM is one where data that would be optimized in the .odex files has been more or less merged back into the .apk files (meaning it is not optimized but basically platform agnostic), thus the .apk files are self-contained and there are no .odex files. This is usually just done with a deodexing utility, such as smali/baksmali.


Everyone wanted the best of both worlds so quickly after the deodexed trend started to peak, these savvy ROM developers came up with a solution to zipalign at boot. This optimizes each .apk on every reboot which then allows the system to access applications more efficiently and most importantly, faster. Of course, the disadvantage is slightly slower boot times.


A .dex (dalvik executable) file is basically similar to Windows' .exe files (except in Dalvik VM's language, instead of compiled code). Basically, .odex (optimized dalvik executable) and deodex (de-optimized dalvik executable) relates to how resource files are handled in the applications. The .odex is a .dex file that have been optimized by the dexopt program:


As of v2.1.0, baksmali now supports deodexing ART oat files. The minimum supported oat version is 56, which should generally correspond to Android 6.0/Marshmallow. oat files earlier than this (e.g. Lollipop) are explicitly not supported, due to some potential issues related to field ordering.


In short, an odex file is an optimized version of a classes.dex file that has optimizations that are device specific. In particular, an odex file has dependencies on every "BOOTCLASSPATH" file that is loaded when it is generated. The odex file is only valid when used with these exact BOOTCLASSPATH files. dalvik enforces this by storing a checksum of each file that the odex file is dependent on, and ensuring that the checksum for each file matches when the odex file is loaded.


These odex dependencies make life a bit difficult for a couple of reasons. For one - you can't take an apk+odex file from one system image and run it on another system image (unless the other system image uses the exact same framework files). Another problem is that if you make any changes to any of the BOOTCLASSPATH files, it will invalidate every odex that depends on that file - basically every apk/jar on the device.


Ok so what is deodex?The odexed file structure works well as an optimization tool, except for in the case of theming. Odexed apps and frameworks present a unique problem to those wanting to theme because the aspect they want to theme is broken up into two files. Typically theming involves swapping out images for home made ones, however this is simply impossible in an Odexed environment. The solution is to DeOdex the file system and reunite all of the uncompressed critical data of an app or framework back into the compressed .apk or .jar file.


Every Android application comes in a package with a .apk extension. These files contain certain .odex files. Odex files are meant to save space. They are collections of parts of an application and optimized before booting the phone.


A Deodexed file is a repacked odex file. They are reassembled into classes.dex. All parts of an application are put together in one place. This way it eliminates the worry that these modified apk files conflict with separate odexed parts.


Deodexed ROMs have their application packages but putting them all together in one place allows easy modification such as theming. Because no pieces of code is coming from any external location, all the ROMs are Deodexed to ensure integrity.


To check is your current ROM is odexed or deodexed you simply have to see the .apkand.odex files. If the ROM is deodexed you will not see any .odexfile in the app directory.


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.


Pada umumnya semua aplikasi android itu berekstensikan(.apk) nah, aplikasi itulah yg bereksentikan (.apk) memiliki file (.odex) yangbertujuan untuk menghemat size data. Dalam file (.odex) terdapat rangkaianbaris program yang bertujuan untuk mempecepat dan mengoptimalkan boot time. Dengankata lain file berekstesikan (.odex) proses booting menjadi lebih cepat.


Deodex yang akan kita bahas saat ini bukan lah file yangberekstensikan seperti (.dex) dan (.odex), namun Deodex disini merupakan prosesmengembalikan kembali file (.dex) yang telah dioptimalisasi (.odex) menjadi file (.dex) . Fungsinya denganmelakukan proses Deodex memungkinkan untuk pengeditan file APK menjadi lebihmudah. Sering disebut apk mod.


Dengan kata lain, ROM yang sudah dijadikan Deodex itu memungkinkanuntuk memodifikasi file (.apk) seperti perubahan tema dan lain-lainnya. Karenapada ROM yang sudah Deodex tidak ada lagi sebagian paket aplikasi yang lokasinyaberbeda dengan kata lain integritas paketnya tetap utuh terjaga. Cara mengetahuiapakah suatu ROM itu Odex atau sudah Deodex yaitu dengan cara masuk padastruktur file sistemnya /system/app/ lalu pada direktori tersebut jikaditemukan file dengan ekstesi (.odex) maka ROM tersebut belum atau bukan Deodex.


Keuntungan Odex adalah pada boot time, menjadikan proses bootinglebih cepat dari Deodex. Kelemahan nya adalah sulitnya untuk mengedit ataumemodifikasi aplikasi, kebalikannya pada Deodex proses pengeditan/modifikasilebih mudah.


Deodex itu aplikasi Odex yang dikemas ulang atau dire-compile dan tiap kode dalvik cache nya di kembalikan lagi ke tiap-tiapaplikasinya, sedangkan Odex itu kode-kode nya terpisah dari aplikasi. Jikasobat punya android dengan menggunakan custom ROM lebih baik menggunakanDeodex.


I'm trying to build a deodexed application from aosp and it works like it was said here CyanogenMod or AOSP: Compile a single project .But mmm outputs odexed app, is there any option to build it deodexed? Also i've included my app in build and when make entire aosp using options DISABLE_DEXPREOPT=true and WITH_DEXPREOPT=false it outputs normal deodexed apk, but it takes too much time to rebuild the entire project every time.


Ganz ehrlich, wie viele von Euch, die das lesen, haben sich die ROM-Foren angeschaut, nur um immer wieder über diesen komplett fremdartigen Begriff zu stolpern. Hey, ist ok, ging mir genauso. Genau genommen bringen die Begriffe Odex und Deodex die Augen von Moddern zum Glänzen. Also, worüber reden die eigentlich?


Wenn Android Eure Apps ausführt oder Framework-Bestandteile verwendet, muss es die in den .apk und/oder .jar Dateien enthaltenen komprimierten Daten lesen und interpretieren. Eine Odex-Dateistruktur beschleunigt diesen Prozess durch eine .odex Datei, welche die wichtigsten Daten unkomprimiert speichert, damit Android diese Daten schnell verarbeiten kann, bevor der restliche, unkomprimierte Teil der Daten verarbeitet wird. Der Sinn ist, die Bootzeiten zu verkürzen und Apps generell schneller laden zu lassen.


Der einzige Grund, sein ROM zu deodexen, ist das Theming/Modding. Es wird Euer Gerät nicht schneller machen. Technisch gesehen sollte es das Gerät sogar verlangsamen, doch in der Praxis ist dieser Unterschied nicht wahrnehmbar. Nach meiner Erfahrung kommt jedes Custom ROM pre-DeOdexed daher und zipaligned eure Apps bei jedem Boot.


En el sistema operativo Android existen multitud de apartados que quizás desconozcas y nosotros te vamos a acercar a través de este tipo de post más información sobre aquellas cosas que te interesan sobre el mundo Android. Vamos a hablar de Odex y Deodex ya que son términos que seguro que habéis escuchado varias veces pero no sabéis con certeza lo que significa por lo que nosotros te lo vamos a explicar más a fondo.


Se denomina Rom Odex cuando los apk de las aplicaciones que tenemos instaladas, van acompañadas de un archivo con terminación .odex cuya función es la de agilizar y optimizar la aplicación. El archivo .odex se podría decir que es la caché de la aplicación que ayuda a iniciar o bootear el sistema Android. Un dato importante que debemos saber es que todas las roms stock son odex. Las custom rom no trabajan con Odex por el hecho de ser más cómodo trabajar con deodex. 2ff7e9595c


0 views0 comments

Recent Posts

See All

Comments


bottom of page