ART Runtime in Android 4.4(kitkat) - Android General

What is ART?
ART stands for Android runtime which is a new runtime like Dalvik which is introduced experimentally in the 4.4 release. This is a preview of work in progress in KitKat that can be turned on in Settings > developer option.n 4.4 both runtimes are now available, Dalvik runtime (libdvm.so) and the ART (libart.so).The user can choose it from developer options.
Click to expand...
Click to collapse
Difference between Dalvik and ART
Dalvik
Dalvik runtime uses JIT(Just-In-Time) compilation to interpret Bytecode
Now lets understand the technical info and terms in the above sentence.
Click to expand...
Click to collapse
Compiler
A compiler is a program or set of programs that transforms source code written in a programming language (the source language) into another computer language
Click to expand...
Click to collapse
Bytecode
Bytecode also known as p-code (portable code), is a form of instruction set designed for efficient execution by a software interpreter
Click to expand...
Click to collapse
Interpreter
Interpreter is a program which translates the source code into computer/machine language
Click to expand...
Click to collapse
JIT compliation
JIT compliation interprets the bytecode into machine language at it's runtime (at the time when the apps are executed).
Click to expand...
Click to collapse
Now summing up all these Dalvik runtime does everything when the apps are executed. Now this is where we must discuss odexed and deodexed ROM. usually all stock ROMs released by OEMs are only odexed only due to this reason. odex means a part of the app is already compiled and it is written into dalvik VM(VM=Virtual Machine). and it runs at boot so while execution of apps JIT has to compile only the remaining part of the code when the apps is executed, this is why odexed ROM is faster than deodexed ROM.
But the disadvantage of odexed ROM is it cannot be edited/themed easily as a part of code is seperated in a separate file, and deodexing means the odex part of the file is put back into the apk/jar itself which makes editing/theming easy since the full code is packed inside a single file but it decreases speed because JIT has to compile full code when the app is executed
ART
ART uses AOT compilation to interpret bytecode.
I hope you can refer to dalvik paragraph to know about these technical terms.
Click to expand...
Click to collapse
what is AOT compilation
AOT is a method of compilation which compiles the code into machine language when the app is installed itself, means no compilation is done at the time of execution of app. This makes the apps launch speed amazingly fast.
Click to expand...
Click to collapse
Advantages of ART over Dalvik
The apps launch speed is amazingly fast in case of ART since nothing is compiled at execution.
Boot speed is faster than dalvik since nothing is execued from dalvik partition as in case of odexed ROM in dalvik
Increases battery backup by reducing CPU work due to absence of compilation work on apps execution.
And finally it is a great reward to developers because most of developers are worried that odexed ROMs are faster than deodexed ROMs but they will deodex their ROMs since they heavily theme it. In case of ART whether the ROM is odexed or deodexed it doesn't matter, it compiles the full code into machine language on installation of apps. so even deodexed ROMs are as fast as odexed in ART
Click to expand...
Click to collapse
Some disadvantages of ART
Since ART precompiles apps on installation, it takes 10-20% more space upon installation than dalvik. But this can be simply solved by using apps like apps2sd/link2sd/gl2sd when your apps storage partition is full
One more is since it is only experimental feature now some apps are incompatible in ART which will be made compatible soon on their updates.
Click to expand...
Click to collapse
Here is the list of apps which are compatible and incompatible in ART.
http://www.androidruntime.com/list
Finally ART is one of the best feature that google brought up in android 4.4 (kitkat)

so, what if I get a rom like that which is on the nexus 6, and it has apks and odex files, how can you deodex these apks, there oviously odexed, because apks like maps are split compared to the deodexed apk, so are they not able to be odexed, or how can this be done
PradeepMurugan said:
What is ART?
Difference between Dalvik and ART
Now summing up all these Dalvik runtime does everything when the apps are executed. Now this is where we must discuss odexed and deodexed ROM. usually all stock ROMs released by OEMs are only odexed only due to this reason. odex means a part of the app is already compiled and it is written into dalvik VM(VM=Virtual Machine). and it runs at boot so while execution of apps JIT has to compile only the remaining part of the code when the apps is executed, this is why odexed ROM is faster than deodexed ROM.
But the disadvantage of odexed ROM is it cannot be edited/themed easily as a part of code is seperated in a separate file, and deodexing means the odex part of the file is put back into the apk/jar itself which makes editing/theming easy since the full code is packed inside a single file but it decreases speed because JIT has to compile full code when the app is executed
Here is the list of apps which are compatible and incompatible in ART.
http://www.androidruntime.com/list
Finally ART is one of the best feature that google brought up in android 4.4 (kitkat)
Click to expand...
Click to collapse

gigawatt said:
so, what if I get a rom like that which is on the nexus 6, and it has apks and odex files, how can you deodex these apks, there oviously odexed, because apks like maps are split compared to the deodexed apk, so are they not able to be odexed, or how can this be done
Click to expand...
Click to collapse
I would first ask you have you seen any such rom first? Mostly 5.0(Lollipop) ROM doesn't have odex files. I own a Nexus 7 2013 LTE version and I am using 5.0. Still now I have used many Lollipop ROMs but i haven't came across any odex files because In lollipop ART is the only Runtime unlike in 4.4. So There is no need of .odex files in lollipop.
P.S : Some claim that they have .odex files in lollipop rom But i haven't seen it. If i get to know it is true or not then we may get a clear conclusion

well, on the nexus 6 there is a folder for each app and inside is an apk file for the app, in some cases a lib folder with lib files inside and then an arm folder with a .odex file, so, either this is an odexed rom, or the files are there as place holders, but there rather large for place holders
PradeepMurugan said:
I would first ask you have you seen any such rom first? Mostly 5.0(Lollipop) ROM doesn't have odex files. I own a Nexus 7 2013 LTE version and I am using 5.0. Still now I have used many Lollipop ROMs but i haven't came across any odex files because In lollipop ART is the only Runtime unlike in 4.4. So There is no need of .odex files in lollipop.
P.S : Some claim that they have .odex files in lollipop rom But i haven't seen it. If i get to know it is true or not then we may get a clear conclusion
Click to expand...
Click to collapse

gigawatt said:
well, on the nexus 6 there is a folder for each app and inside is an apk file for the app, in some cases a lib folder with lib files inside and then an arm folder with a .odex file, so, either this is an odexed rom, or the files are there as place holders, but there rather large for place holders
Click to expand...
Click to collapse
well even I have lib folder and arm folder but there is no odex file inside them

Related

New Kernel Install

What is the best way of flashing a new kernel over a different one a rom came with?
I just only normally wipe cache n delvik?
jheysl2 said:
What is the best way of flashing a new kernel over a different one a rom came with?
I just only normally wipe cache n delvik?
Click to expand...
Click to collapse
just flash, kernel devs already include a line in the updater-script code that deletes cache and dalvik is not related to kernel in any way, shape or form
Explanation of Dalvik Cache:
Jonny said:
Dalvik cache is composed of the classes.dex files of a deodexed rom or the .odex files from an odexed rom, ie all the code from the apk's so nothing in it is kernel related therefore wont break schedulers. The apk code is stored in dalvik cache to allow for fast access to that code if needed so that the OS doesnt need to waste time extracting the classes.dex or .odex file everytime an app needs to run. Also because most apps pull/push information from ot to other apps, so the OS needs that code allready available.
Click to expand...
Click to collapse

[Complete Guide] What is Odex and Deodex ROM?

What is an ODEX file?
In Android file system, 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. On the other hand, it also makes hacking those applications difficult because a part of the coding has already been extracted to another location before execution.
What is an DEODEX file?
Deodexing is basically repackaging of these APKs in a certain way, such that they are reassembled into classes.dex files. By doing that, all pieces of an application package are put together back in one place, thus eliminating the worry of a modified APK conflicting with some separate odexed parts.
So, Deodexed ROMs (or APKs) have all their application packages put back together in one place, allowing for easy modification such as theming. Since no pieces of code are coming from any external location, custom ROMs or APKs are always deodexed to ensure integrity.
How this works?
For the majority noobs amongst us, Android OS uses a Java-based virtual machine called the Dalvik Virtual Machine. A deodexed or .dex file contains the cache used by this virtual machine (referred to as Dalvik-cache) for a program, and it is stored inside the APK. An .odex file, on the other hand, is an optimized version of this same .dex file that is stored next to the APK as opposed to inside it. Android applies this technique by default to all the system applications.
When an Android-based system is booting, the davlik cache for the Davlik VM is built using these .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. Since all code is now contained within the APK itself, it becomes possible to modify any application package without conflicting with the operating system’s execution environment.
Advanteges & Disadvantages
The advantage of deodexing is in modification possibilities. This is most widely used in custom ROMs and themes. A developer building a custom ROM would almost always choose to deodex the ROM package first, since that would not only allow him to modify various APKs, but also leave room for post-install theming.
On the other hand, since the .odex files were supposed to quickly build the dalvik cache, removing them would mean longer initial boot times. However, this is true only for the first ever boot after deodexing, since the cache would still get built over time as applications are used. Longer boot times may only be seen again if the dalvik cache is wiped for some reason.
Note:Themes for android come in APKs too, and if you want to modify any of those, you should always choose a dedoexed custom ROM.
[Guide] What is Zipalign and how to make Apps zipaligned
What is Zipalign?
Zipalign is an archive alignment tool introduced first time with 1.6 Android SDK (Software Development Kit). It optimizes the way an Android application package (APK) is packaged. Doing so enables the Android operating system to interact with the application more efficiently, and hence has the potential to make the application and overall the whole system much faster. Execution time is minimized for zipaligned applications, resulting is lesser amount of RAM consumption when running the APK.
How does it exact work?
In an Android operating environment, data files stored in each application package are accessed by multiple processes, for example, the installer will read the data manifest to determine the associated permissions; the system server can read these resources for multiple reasons, like displaying notifications; the Home application, for example, will read resources to get the application’s name and icon. Since Android is based on a a true multi-tasking operating infrastructure, these files are continually and repeatedly accessed. Finally, but not least, the application itself reads the manifest data.
As Android is Linux-based, memory-mapping plays a key role in efficient handling of processes. Essentially, the optimal alignment for the Android OS’ resource-handling code is 4-byte boundaries. What this means is that, if APKs are memory-mapped to 4-byte boundaries, and aligned accordingly, the OS will not need to ‘read through’ the whole application package to get to the desired data manifest. Every system process will know in advance where to look for it’s desired resources, and hence will execute much smoother and faster.
Summing it up, zipaligning an APK results in all uncompressed data within the package to be aligned on 4-byte boundaries, allowing all portions to be accessed directly with the memory-map. RAM consumption is lowered while execution because the querying code doesn’t have to read through the entire application package.
Disavantages of unaligned APKs
Quite understandably, situation would be reserved for unaligned application packages. Resource reading would be slow and memory usage would be on the higher end of the spectrum. It would also depend on how many unaligned applications are present. For example, if less number of applications with an unaligned home application, you’d see slower application launch times. This is the best case scenario. For a worst case scenario, having a number of unaligned applications will result in the system repeatedly starting and killing processes, struggling with lags and huge battery drain.
How to make APKs zipaligned?
As mentioned earlier, the zipalign tool became a part of Android SDK from 1.6 onwards. It can be found under the ‘tools’ folder of the SDK. To use it, simply run the command:
zipalign [-f] [-v] <alignment> infile.apk outfile.apk
Click to expand...
Click to collapse
...where infile.apk is the source file, and outfile.apk is the output file.
You can also verify the alignment of an APK file using the following command:
zipalign -c -v <alignment> existing.apk
Click to expand...
Click to collapse
...where existing.apk can be any application package that you need to get verified. Also, the <alignment> tag in both the commands needs to be an integral value (otherwise the command will return invalid). This value, although can be any integer, MUST always be 4, which would provide 32-bit alignment. Any other value and it will effectively do nothing.
Finally, for the flags used in these commands,
-f - overwrites existing outfile.zip
-v - will give verbose output
-c - will confirm the alignment of a given file
Click to expand...
Click to collapse
CAUTION: Zipalign operation must only be performed after you have signed the APK file with your private key. If zipaligned before signing, the signing procedure will disturb the alignment. Same holds true for any other alteration, addition or removal to the APK file. Any change after running zipalign will undo the alignment.
Source: addictivetips
[GUIDE] How to Deodex Jelly Bean firmware (I9070) - credits must go to anantttt
[How-To] Re-Odex a Rom - credits must go to TearsDontFalls -this guide is for S3, but you have Google to find what you need ... if you really need.
[ODEX][SCRIPT/TOOL] Odexer Tool 1.2 (03-28-2014)(MM-dd-yyyy)
Update 08.10.2014
Click to expand...
Click to collapse
[SCRIPT TO ODEX] Universal Odex Script Version 6.3.1 (11-03-2013)
Credits & Thanks for this tool:
MatrixDJ96
Click to expand...
Click to collapse
I think you just must create 1 thread titled "About Android" or someting like that
BTW it is good to know that:thumbup::thumbup:
Sent from my GT-I9070 using xda app-developers app
This materials are not created by me, I just searched and read carefully over the WWW in an attempt to bring as much informations to our forum S. Advance.
Only this was my job, along with the desire to know the phone held.
In my opinion, one thread with all the information is difficult to manage, because of that i'm so reluctant in what concerns for easy finding by members.
Make a Guide on how to (Re)Odex a Deodexed ROM if possible...
Sent from my GT-I9070 using xda app-developers app
Flash stock ROM?
R_a_z_v_a_n said:
Flash stock ROM?
Click to expand...
Click to collapse
Hahahaha.. but I wasn't Joking.. people say that its always better Re-Odex a Deoxed app after editing it
Understand now. Let me do some research and read what to do in that sense ...
Sami Kabir said:
Make a Guide on how to (Re)Odex a Deodexed ROM if possible...
Click to expand...
Click to collapse
Make it very short then.
Odex Me
(Post useful? Hit the Thanks button etc.)
Odex and Deodex
Hi,
I am a beginner in the android world and i have been trying to understand the android terms in detail. but i am still confused over the ODEX and DEODEX terms. I read you post but it still needs some more explanation of few things mentioned below.
Where is the .ODEX file stored in case of an ODEXED Rom?
Does the Dalvik Cache builds up in case the ROM in Deodexed. If yes then from where it fetches the required information?
Your post says that boot speed is increased in case of both the ODEX & DEODEX ROM after the first Boot. Then what is the exact difference between the two ROMS?
Does Dalvik Cache & DalviK VM independent whether the ROM is ODEX or DEODEX?
Presently my phone is ODEX (Stock ROM), once i DEODEX the ROM can i still install .APK files from Google Play or any other source?
Is tools which makes an APK ODEX or DEODEX part of the android operating system or should we make an APK Odexed or Deodexed using a laptop?
Please help me with the above questions.
R_a_z_v_a_n said:
What is an ODEX file?
In Android file system, 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. On the other hand, it also makes hacking those applications difficult because a part of the coding has already been extracted to another location before execution.
What is an DEODEX file?
Deodexing is basically repackaging of these APKs in a certain way, such that they are reassembled into classes.dex files. By doing that, all pieces of an application package are put together back in one place, thus eliminating the worry of a modified APK conflicting with some separate odexed parts.
So, Deodexed ROMs (or APKs) have all their application packages put back together in one place, allowing for easy modification such as theming. Since no pieces of code are coming from any external location, custom ROMs or APKs are always deodexed to ensure integrity.
How this works?
For the majority noobs amongst us, Android OS uses a Java-based virtual machine called the Dalvik Virtual Machine. A deodexed or .dex file contains the cache used by this virtual machine (referred to as Dalvik-cache) for a program, and it is stored inside the APK. An .odex file, on the other hand, is an optimized version of this same .dex file that is stored next to the APK as opposed to inside it. Android applies this technique by default to all the system applications.
When an Android-based system is booting, the davlik cache for the Davlik VM is built using these .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. Since all code is now contained within the APK itself, it becomes possible to modify any application package without conflicting with the operating system’s execution environment.
Advanteges & Disadvantages
The advantage of deodexing is in modification possibilities. This is most widely used in custom ROMs and themes. A developer building a custom ROM would almost always choose to deodex the ROM package first, since that would not only allow him to modify various APKs, but also leave room for post-install theming.
On the other hand, since the .odex files were supposed to quickly build the dalvik cache, removing them would mean longer initial boot times. However, this is true only for the first ever boot after deodexing, since the cache would still get built over time as applications are used. Longer boot times may only be seen again if the dalvik cache is wiped for some reason.
Note:Themes for android come in APKs too, and if you want to modify any of those, you should always choose a dedoexed custom ROM.
Click to expand...
Click to collapse
fredrickaein said:
1.Where is the .ODEX file stored in case of an ODEXED Rom?
2.Does the Dalvik Cache builds up in case the ROM in Deodexed. If yes then from where it fetches the required information?
3.Your post says that boot speed is increased in case of both the ODEX & DEODEX ROM after the first Boot. Then what is the exact difference between the two ROMS?
4.Does Dalvik Cache & DalviK VM independent whether the ROM is ODEX or DEODEX?
5.Presently my phone is ODEX (Stock ROM), once i DEODEX the ROM can i still install .APK files from Google Play or any other source?
6.Is tools which makes an APK ODEX or DEODEX part of the android operating system or should we make an APK Odexed or Deodexed using a laptop?
Click to expand...
Click to collapse
Some answers, I numbered your questions to be more easily tracked
1. In your /system
2. Android's Dalvik goes through every apk's and extracts the dex file from it. It places the dex files in the cache folder - located at /data/dalvik-cache. This is the directory that gets cleared when you clear the dalvik cache in your custom recovery like CWM or TWRP.
3. The difference is that deodexed ROMs are lighter and allow modifications but odexed ROMs load faster. ROMs come with Zipalign at boot that make a deodexed ROM load as fast as an odexed ROM.
4. I dont know the answer of this ... sorry.
5. Of course you can, is no reason to worry about.
6. You need android-sdk installed in your computer/laptop, busybox on the phone, xUltimate and some knowledge about whole process.
Thanks a few more on odexed and deodexed ROM
Hi,
Many thanks for your prompt reply. But please bare with me as i am going to ask more questions
Firstly let me ask you some more queries related to the earlier questions
1 Which folder in my ROM. I have root access, so i would like to view the files.
2 got it. saw the directory where the delvik cache is stored, but in case of a deodexed rom does this happen? i mean does the system store the dalvik cache by going through the apk if the ROM is deodexed. in other words does dalvik cache exist for deodexed ROM?
3 why is the deodexed ROM lighter? is it because it stores the app info at one place?
4. actually the question is same as no 2 above, Will i see the delvik-cache folder anymore if i deodex my ROM? if no then does the zipalign provides necessary data for the dalvik VM?
5.Ok i understood this
6. the process you are talking about is how to deodex my ROM. So i guess once i try to deodex my ROM the process will convert all the odexed app in my phone to deodexed. and henceforth all the appliccation that i install will be installed as a deodexed app. am i right in my guess?
Now some more questions please
7. is the only difference between them is the fact that odexed rom stores the app in two places and deodexed rom stores as a single apk?
8. what exactly is the .ODEX dex file. Is it a full copy of the apk or only a part of the apk. i guess it is this .ODEX file that makes the odexed rom heavy while the deodexed rom doesnt contain a .ODEX file which makes it lighter
R_a_z_v_a_n said:
Some answers, I numbered your questions to be more easily tracked
1. In your /system
2. Android's Dalvik goes through every apk's and extracts the dex file from it. It places the dex files in the cache folder - located at /data/dalvik-cache. This is the directory that gets cleared when you clear the dalvik cache in your custom recovery like CWM or TWRP.
3. The difference is that deodexed ROMs are lighter and allow modifications but odexed ROMs load faster. ROMs come with Zipalign at boot that make a deodexed ROM load as fast as an odexed ROM.
4. I dont know the answer of this ... sorry.
5. Of course you can, is no reason to worry about.
6. You need android-sdk installed in your computer/laptop, busybox on the phone, xUltimate and some knowledge about whole process.
Click to expand...
Click to collapse
My friend,
You ask too many questions and I do not think going somewhere after you have the answers.
So, lets start with ...
1.There is two place: I tell you in system/root ... search for directors -> data/app or system/app
2 Of course. Because of this the first start of a deodexed ROM is slower.
3 ... is it because it stores the app info at one place? I dont know for sure, but is one of the explanation. Lighter can also mean that the apk can be modified by Themers much easier without any risk.
4. Yes will see the folder, i just tell where is located from my phone when i answered before. And i have my ROM deodexed and zipalign
5....
6. You are right.
7. Yes, and much easier to theme without risks
8. I guess is correct, dont know much about that
present hipirch
Dear Razvan,
Thanks for the help. I am very curious in nature, that why i bothered you so much.
Now please a last suggestion from you.
Shall i Deodex my Samsung Stock ROM? or go for already deodexed Pure Vanila or Jelly Bean LQB / SlimJB - Shaaan (Your Rom). please Suggest.
And also based on your experience, which Custom ROM you prefer for Galaxy S Advance (Just your Opinion )
R_a_z_v_a_n said:
My friend,
You ask too many questions and I do not think going somewhere after you have the answers.
So, lets start with ...
1.There is two place: I tell you in system/root ... search for directors -> data/app or system/app
2 Of course. Because of this the first start of a deodexed ROM is slower.
3 ... is it because it stores the app info at one place? I dont know for sure, but is one of the explanation. Lighter can also mean that the apk can be modified by Themers much easier without any risk.
4. Yes will see the folder, i just tell where is located from my phone when i answered before. And i have my ROM deodexed and zipalign
5....
6. You are right.
7. Yes, and much easier to theme without risks
8. I guess is correct, dont know much about that
Click to expand...
Click to collapse
Do not you worry I did not mind. :highfive:
You can put a deodexed ROM, but only if you want to apply some themes or customization, otherwise there is no reason to do so.
Frankly, in terms of what ROM to install, I can not give any advice, because besides his SlimJB Shaaan, i did not try any custom ROM, but i'm waiting, in silence , Cyanogen ROM stable and then i can make a choice.
Good luck
Yeah, I am also waiting for a stable 10.1 of cynogen. But how is the rom that you are using? How stable is it? I am also planing to try pure vanila till we have a stable release of cynogen. Anyways many thanks for the help.
R_a_z_v_a_n said:
Do not you worry I did not mind. :highfive:
You can put a deodexed ROM, but only if you want to apply some themes or customization, otherwise there is no reason to do so.
Frankly, in terms of what ROM to install, I can not give any advice, because besides his SlimJB Shaaan, i did not try any custom ROM, but i'm waiting, in silence , Cyanogen ROM stable and then i can make a choice.
Good luck
Click to expand...
Click to collapse
For the moment i'm using LQB Serbia, deodexed, zipaligned and debloated with CoCore 6.x kernel and i'm SOOO happy .... but we are OFF TOPIC here, thanks for understanding me.
Just a question. I am now on stock odex DXLSE with speedmod kernel. Can I flash on cwm the deodexed version of the same rom without wiping the data and without losing all of my files? Thanks.
JB? Rooted?
Its necessary...
Sent from my GT-I9070 using xda premium

[Explained] Difference between Odex and Deodex?

Odex versus Deodex​
As an Android newbie, what bothered me most was coming across terminology beyond my comprehension. Not coming from a Linux background it became hard to keep up with the oh-so-commonly-used words spread all across the development community. Likewise, since I didn’t understand the terms, consequently I was unable to determine is something was of any use to me or not. From what I have seen, this problem extends to many novice and even average users.
One commonly occurring word when playing with custom ROMs and firmware, and even themes is deodexed and odexed. Most users fail to understand what these terms actually imply, and while developers would boast again and again about their themes and ROMs being deodexed, the average user is left clueless as to what is going on.
What is an .odex file?
In Android file system, 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. On the other hand, it also makes hacking those applications difficult because a part of the coding has already been extracted to another location before execution.
Then comes deodex!
Deodexing is basically repackaging of these APKs in a certain way, such that they are reassembled into classes.dex files. By doing that, all pieces of an application package are put together back in one place, thus eliminating the worry of a modified APK conflicting with some separate odexed parts.
In summary, Deodexed ROMs (or APKs) have all their application packages put back together in one place, allowing for easy modification such as theming. Since no pieces of code are coming from any external location, custom ROMs or APKs are always deodexed to ensure integrity.
How this works
For the more geeky amongst us, Android OS uses a Java-based virtual machine for running applications, called the Dalvik Virtual Machine. A deodexed, or .dex file contains the cache used by this virtual machine (referred to as Dalvik-cache) for a program, and it is stored inside the APK. An .odex file, on the other hand, is an optimized version of this same .dex file that is stored next to the APK as opposed to inside it. Android applies this technique by default to all the system applications.
Now, when an Android-based system is booting, the davlik cache for the Davlik VM is built using these .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. Since all code is now contained within the APK itself, it becomes possible to modify any application package without conflicting with the operating system’s execution environment.
Advantages & Disadvantages
The advantage of deodexing is in modification possibilities. This is most widely used in custom ROMs and themes. A developer building a custom ROM would almost always choose to deodex the ROM package first, since that would not only allow him to modify various APKs, but also leave room for post-install theming.
On the other hand, since the .odex files were supposed to quickly build the dalvik cache, removing them would mean longer initial boot times. However, this is true only for the first ever boot after deodexing, since the cache would still get built over time as applications are used. Longer boot times may only be seen again if the dalvik cache is wiped for some reason.
For a casual user, the main implication is in theming possibilities. Themes for android come in APKs too, and if you want to modify any of those, you should always choose a dedoexed custom ROM.
Full credits to the source: addictivetips.com
Update: Here's a link to the Universal Odex Script made by MatrixDJ96
Thanks mate, You really saved my lot of time.:good:
Native7i said:
Thanks mate, You really saved my lot of time.:good:
Click to expand...
Click to collapse
You're welcome!
I really wanted to know about that, since people mention it a lot lately, thanks
Nice write up very proffesional this should be stickied for new users
Sent from my SCH-I500 using Tapatalk 2
Thanks!
Thanks! helped me alot! very informative.
The best explanation
If you want, you can share my universal odex script for all phone in your thread
Sent from my GT-I9100 using xda app-developers app
Thank you. As a newbie, I learned a lot from your explanations.
MatrixDJ96 said:
The best explanation
If you want, you can share my universal odex script for all phone in your thread
Sent from my GT-I9100 using xda app-developers app
Click to expand...
Click to collapse
Hey MatrixDJ96
I've added the link to your script.
Wow, this was a real lifesaver :victory: I finally can differentiate
:good:
nice write up
Thanks
Thanks, Really help a lot...
that was a really clear explanation - thanks!

[Script] [Unmaintained] Quick Deodex Tool (v1.0.2)

Due ART changes, Quick Deodex doesn't work with Android Lollipop/Marshmallow/Nougat ROMs. I might update this script some day, but due other priorities and lack of time, this tool is currently unmaintained.
Well, if you ever tried to deodex a single APK file you should know how tricky this process can be. Searching XDA we find various tools and tutorials in how to deodex but most of them may look complicated enough to make a newbie or an user that never messed around with Android system give up. So, I wrote my own script to simplify two tasks: deodexing and zipaligning. I also made this script with newbies in mind, so, I did my best to make this tool as straightforward, small and portable as possible.
Requirements
• For Linux, you need OpenJDK 6 or newer
• For Windows, you need Java SE runtime 6 or newer
Instructions
• Download the script and extract it somewhere
• Grab a copy of the folders "framework", "app" and "priv-app" (optional, KitKat only) and put them inside "files" folder
• Run quick_deodex.bat (or quick_deodex.sh on Linux) and wait while the files are being deodexed
• After the script finishes, all files inside the folders you copied before will now be deodexed and zipaligned.
Any file that fail to deodex will be skipped and left intact, so you can fix what caused the problem and run the tool again. If all files fail to deodex, make sure Java runtimes are installed properly
Frequently Asked Questions
Q: I keep getting "Framework not found" error. What should I do?
A: For most APKs you can only deodex if you have the framework files, so, I made this a requirement, even if you want to deodex only a single file. In that case, grab a copy of "framework" folder from the same ROM you got the APK and run this script again, it'll fix that.
Q: I'm trying to deodex an entire ROM but some files get errors and aren't deodexed. What should I do?
A: This usually occur only if the files you're trying to deodex and the framework are from different ROM versions. If the files are all from the same ROM version and you're still getting this, try updating smali and baksmali components used by this script by downloading an updated copy and replacing the ones this script uses (located in "tools" folder).
Changelog
Version 1.0.2
• Minor bug fixes (Linux only)
Version 1.0.1
• Now compatible with Linux
Version 1.0
• Initial release
+1
It work without errors.
thanks man, it's first tools that perfectly worked.
Hey, has anyone tested the Linux version? Did it work? Linux users, leave some feedback
mbc07 said:
Hey, has anyone tested the Linux version? Did it worked? Linux users, leave some feedback
Click to expand...
Click to collapse
I will test out the Linux script later, in the process of doing clean install of 14.04 and setting up build environment, currently the windows verison is running though, looks like you have done a very nice job here, thank you a lot.
Version 1.0.2 is out, it fixes "Permission denied" errors that may occur in some Linux distros...
mbc07 said:
Version 1.0.2 is out, it fixes "Permission denied" errors that may occur in some Linux distros...
Click to expand...
Click to collapse
Still haven't gotten around to it, If all else fails, I will get time this weekend, stuck doing some cad drawings the next few days!
I keep getting this error in Ubuntu 14.04. ( Using Java7 Open JDK AMD64 version )
Exception:
Code:
JNLParseException[ Could not parse launch file. Error at line 0.]
at com.sun.javaws.jnl.XMLFormat.parse(Unknown Source)
at com.sun.javaws.jnl.XMLFormat.parse(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at com.sun.javaws.Main.launchApp(Unknown Source)
at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
at com.sun.javaws.Main.access$000(Unknown Source)
at com.sun.javaws.Main$1.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)
Wrapped Exception:
Code:
Failed to find the '<' charater that marks the end of a CDATA element. Exception parsing xml at line 0
at com.sun.deploy.xml.XMLParser.skipPCData(Unknown Source)
at com.sun.deploy.xml.XMLParser.nextToken(Unknown Source)
at com.sun.deploy.xml.XMLParser.parse(Unknown Source)
at com.sun.javaws.jnl.XMLFormat.parse(Unknown Source)
at com.sun.javaws.jnl.XMLFormat.parse(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at com.sun.javaws.Main.launchApp(Unknown Source)
at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
at com.sun.javaws.Main.access$000(Unknown Source)
at com.sun.javaws.Main$1.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)
@DarkAngel if it's a Java error, then it's related either to smali/baksmali or to the input files, not to the script itself. I would suggest testing the files you're trying to deodex in other tools, if they work, report to me what tool worked so I can try to figure out what's wrong in Quick Deodex...
@mbc07 I did keep seeing that and even made sure my path was set for Java. I'll see what I can come up with.
Having switched to a new Laptop has had me looking for new things as I was already set up before. ADB/Fastboot, JOdin3/Heimdall I can do fine. Windows I'm good to go as well I just rather do more/learn more in Linux this time around.
@mbc07
I tried it once again, this time uninstalling & purging all copies of Java ( only had version 7 & 8 though ) and then reinstalled version 7 only. I still get the same error. I did also try updating the smali and baksmali components just in case but no dice.
-------------------------------------
Windiows version, on the other hand, did go smoothly with no problems for me at all. Deodexed both folder perfectly w/ no errors ( JB 4.2.2 ). Tried them on a phone I have and all is working perfectly. :good:
With Dalvik runtime the deodexed files works well but when switching to ART I'm having bootloop.
Tested with Nexus 4 stock 4.4.4 KTU84P (during the deodex process there wasn't any errors) and clean install (factory reset)
Try updating smali / baksmali, I'm not running KitKat so there's not much I can do to test that =/
mbc07 said:
Try updating smali / baksmali, I'm not running KitKat so there's not much I can do to test that =/
Click to expand...
Click to collapse
If this can help you to fix the bug (or help someone else that encounter the same problem), I solved the problem by using this deodexer with compression level 0.
Desno365 said:
If this can help you to fix the bug (or help someone else that encounter the same problem), I solved the problem by using this deodexer with compression level 0.
Click to expand...
Click to collapse
Thanks for the tip, I'll take a look at it...
THANK YOU!!!!
mbc07 said:
Well, if you ever tried to deodex a single APK file you should know how tricky this process can be. Searching XDA we find various tools and tutorials in how to deodex but most of them may look complicated enough to make a newbie or an user that never messed around with Android system give up. So, based in Kamome tool and @RyokoN work, I wrote my own script to simplify two tasks: deodexing and zipaligning. I also made this script with newbies in mind, so, I did my best to make this tool as straightforward, small and portable as possible.
Requirements
• For Linux, you need OpenJDK 6 or newer
• For Windows, you need Java SE runtime 6 or newer
Instructions
• Download the script and extract it somewhere
• Grab a copy of the folders "framework", "app" and "priv-app" (optional, KitKat only) and put them inside "files" folder
• Run quick_deodex.bat (or quick_deodex.sh on Linux) and wait while the files are being deodexed
• After the script finishes, all files inside the folders you copied before will now be deodexed and zipaligned.
Any file that fail to deodex will be skipped and left intact, so you can fix what caused the problem and run the tool again. If all files fail to deodex, make sure Java runtimes are installed properly
Frequently Asked Questions
Q: I keep getting "Framework not found" error. What should I do?
A: For most APKs you can only deodex if you have the framework files, so, I made this a requirement, even if you want to deodex only a single file. In that case, grab a copy of "framework" folder from the same ROM you got the APK and run this script again, it'll fix that.
Q: I'm trying to deodex an entire ROM but some files get errors and aren't deodexed. What should I do?
A: This usually occur only if the files you're trying to deodex and the framework are from different ROM versions. If the files are all from the same ROM version and you're still getting this, try updating smali and baksmali components used by this script by downloading an updated copy and replacing the ones this script uses (located in "tools" folder).
Q: I want to deodex a KitKat ROM, but it have an additional "priv-app" folder with .odex files. Is this script compatible?
A: Yes, it is. When "priv-app" folder is present, the script handle it accordingly. Otherwise the script assumes it's a JellyBean ROM or older and skips "priv-app".
Changelog
Version 1.0.2
• Minor bug fixes (Linux only)
Version 1.0.1
• Now compatible with Linux
Version 1.0
• Initial release
Click to expand...
Click to collapse
Thank you so much!!! My phone doesn't play nice with deodexing. I've tried before to deodex my files with the kitchen, but always had problems. This tool is so easy to use, and it seems to work perfectly!!!! I have an old phone (LG Spectrum), and I am still a NOOB, but with your tool, I now have a debloated, customized deodexed zipaligned rom I can flash with no problems!!!!!
Thanks a bunch for this and thankkkkkks for making it work for linux, cant believe all the folks making deodex scripts that only work on windows tyty.
works perfectly .. just wanted to know how can i know is it zipling or not?
manan001 said:
works perfectly .. just wanted to know how can i know is it zipling or not?
Click to expand...
Click to collapse
The script zipalign the file right after it gets deodexed. If the zipalign process fails, the script will output "FAILED" and the file will remain untouched.
In other words, if you got "DONE" in the script, the file were successfully deodexed and zipaligned...
Nice tool but not working in windows 64bit but working fine in 32bit
Downloaded the latest update of smali/baksmali but the result is almost 50% ERROR, others DONE
modfiles said:
Nice tool but not working in windows 64bit but working fine in 32bit
Downloaded the latest update of smali/baksmali but the result is almost 50% ERROR, others DONE
Click to expand...
Click to collapse
The script works perfectly in 64-bit editions of Windows. However, you need also to install 64-bit edition of Java, otherwise it won't work. About your errors, check your input files, if possible, try to find another tool that successfully deodex them and tell me which tool is so I can take a look and fix Quick Deodex :good:

Root / Custom Roms: Odexed and Deodexed, what's the difference?

For those interested in Custom ROMs and the modding scene, you've probably already heard of the terms ''odexed'', a characteristic of Android ROMs and ‘’deodexed'', an element known from custom ROMs. But what exactly hides behind these two terms and which advantages or even disadvantages does each one present? Well, let me explain...
Odexed
With an odexed ROM, you'll find files which end with .odex within the system app folders. This stands for ''Optimized Dalvik Executable File''. Browser.apk and browser.odex will appear in the /system/app folder as well.
But what's an .odex file?
And most importantly, for what is an .odex file used? It serves the purpose of organizing the system structure which contains application information (start up, usage, etc) and allows Android to access this information without having to go search for them and decompress them from .apk files. Odex files are directly loaded into the dalvik cache, which you've probably heard of when talking about wiping before or after flashing a ROM. This allows your system to run a lot quicker.
Advantages of an Odexed ROM
-Applications start a lot faster since the important information has already been loaded by the system beforehand.
-The .apk files are not as big, therefore they take up less room.
Disadvantages
App modding/themes/hacking becomes a lot more difficult because the code is now found in two different locations.
If you delete some of the app data, the .odex file must also be deleted in order to avoid errors.
The usual classes.dexfiles files in an APK: here are the ones from the navigator / © AndroidPIT
Deodexed
When it comes to a deodexed ROM, all of the application information is found in an .apk file. The code found in the .odex files are added to the apk under the name classes.dex.
Advantages
Deodexed is a lot easier for modding/themes/hacking, because the data is found within the APK.
System apps are easier to delete, since only the APK must also be deleted.
Disadvantages
The program library can't be loaded beforehand, therefore slowing down the app start.
Bootloading also slows way down because the APK content first needs to be taken from the system for the reason that a direct access is no longer present.
It's important to note that these two disadvantages quickly go unnoticed since the dalvik cache stores information that has been extracted from the APK and saves it, to then be retrieved later on. Longer loading times would then be a direct consequence of emptying the Dalvik cache in the event of a Custom Recovery.
Bottom Line
Android versions which come directly from manufacturers are in most cases odexed. Custom ROMs on the other hand are deodexed nine times out of ten, which allows them to take up less room and offer more customization possibilities. So there you have it: odexed versions are optimized for speed, while deodoxed is better for hacking, themes and modding. Simple, right?
Right sir?
Enviado desde mi SM-N910S mediante Tapatalk

Categories

Resources