Gadgetory


All Cool Mind-blowing Gadgets You Love in One Place

Android Power User: What are ODEX, DEODEX, and ZIPALIGN?

2012-09-25
Oh dexing and do dexing their terms that we hear quite a bit when we're talking about custom roms some argue that one is better than the other while others argue the opposite what are they well they mean why do we have them and which one really is better that's what we're going to find out on today's episode of the Android power user Android apps are essentially stored in dot apk files and most of the time we consider those just standalone files and a lot of times they are sometimes they're not some people also think that a dot apk is an installer file a little confusing there isn't it but for the purpose of this video a PK's are essentially android packages plain and simple okay so let's move right along we talked about how android apps are not precompiled they're not really raw code there's some other bits to it but they're not compiled in the traditional sense of the word and not all of it for example some of the app the most common bits and pieces to the app are pre optimized not necessarily compiled but optimized and I'll give you a hint that's where the Oh from ode X comes into play okay so what we do is we go through and we we pre optimize our apps so that they can be run and by we I mean developers and and the system itself end-users don't worry all this is done for you you don't have to worry about it but it's pre optimized for you so that the bits and pieces that you're going to be using are already there they're already super fast and while they're running the rest of the stuff compiles and executes in the background lots and lots of advantages again go back to those last couple episodes so you can see what they are now if we didn't do this pre optimization things might be a little bit slow they're not and I'll tell you why because there's other things that account for that but what we do is we optimize these files and that's what an ode X is so dot ode X is a file extension it stands for optimized dalvik executable and this is it's a compressed file it's very much like an exe in Windows except it's not truly precompiled like an exe and windows is it's just pre optimized now if you try and open up an ode X file you're not going to be able to read much because the optimization renders it looking something very executable like or compiled like so the advantage to it is it saves space okay it's it's optimized it's compressed and it occupies less disk space that's great means you can fit more apps on there it's also pretty optimized so that it runs faster it has all the bits that are needed to bootstrap that application and get it up and running while that's doing its thing then other things that you need can be pre-loaded as you need them or just before you need them which is an intelligence thing inside Android itself or inside the dalvik itself so the downside to Oh Dex files it's a separate file it's physically separate from the dot apk and the bits are not in the apk if they're in the Oh Dex why do we care well if you want to go in and make a change say you've got a file an app that checks to see what phone you're using to make sure it's on the compatible list and it does that inside the apk itself or inside the app itself if you've got a do Dex or excuse me if you've got a an o Dex file that setting is probably held inside that o Dex and you can't get at it you can't get to it so you need to be able to do Dex that file D optimize it so that you can get at that setting so you can change it to just ignore it I know it works on my phone and everything's fine or if you want to swap out images inside the app say you want to theme it you want a dark theme you want a green theme you want a pink theme you want to be able to theme that app and switch out images switching images is relatively easy but not if they're stored inside and Oh Dex okay so let's talk about do Dex most of the time when you hear the term Oh Dex it's in the context of a custom ROM and robbers all over the place will say mine's a do Dex ROM yeah okay that's just fancy talk and say good that means I can do whatever I want with it and it's a custom ROM so I should I should be able to do that custom roms should be do text plain and simple if they're not no big worry but generally speaking custom ROM do Dex one implies the other so we've talked a Dex we've talked do Dex what about zip align does it have anything to do with this no not really oh you want to know what it is anyway all right we can go ahead and do that so let me review straight from developer.android.com is bear with me just a minute so zip aligning make sure that all of an app's uncompressed data starts at a particular alignment relative to the start of the file all right I had to go back and read that because this is like the third take I'm trying to get that just right essentially there's a lot of technical reasoning behind why they do this it basically puts everything that needs to be aligned in a certain order in a certain place it has to do with arrays and M maps and all kinds of stuff I'll let you go out and read the article about it at developer.android.com there is a link in this article so make sure you head over to pocketnow.com and watch this you'll have the link right there to that article so you can read all about it essentially what ziplining does is it allows the app to take up less space in memory by putting everything all nice together in alignment it has to do with memory architecture and and bit alignment and all kinds of stuff that we're just not going to get into but before you release a custom app developers I'm talking to you make sure you zip align it so that it takes up less space and it runs more efficiently and just works better with all its neighbors okay for all of you end users don't really worry about it now you know kind of what it is and what it does and if you want to sound smart you can always ask that guy who's writing an app via zip-lined that and if he comes back oh yeah absolutely done that soon great it'll make you sound smart fair enough do Dex Oh Dex ziplining there are all things that help Android apps work better faster and do all kinds of cool stuff and now you know a little bit more about how and why they do that if you like learning about this stuff and you like the Android power user make sure you give the video a big thumbs up by clicking the thumbs up button down below that helps share the video with your friends if you haven't yet subscribed make sure you do that we'll have a link at the end of the video that way you'll get the next episodes that are coming along with the other cool stuff that we're talking about at pocketnow.com if you want to go back and watch the other stuff in the android power user series I'll have a link for you there as well last but not least please any comments that you have any discussion that you want to add clarifications real-world examples if you're not watching this video at pocketnow.com already please do that head over to would there's the link the article at PocketNow leave the comments over there that's where we're going to try and keep the conversation so we don't have a conversation there and at YouTube as well that makes sense it'd be great I'd appreciate it thanks so much so you're a little bit smarter today congratulations we'll be working on getting that Android power user diploma out to you by the end of the week we don't have those but if we did we would for pocket now the Android power user I'm Joe Levi thanks for watching you
We are a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for us to earn fees by linking to Amazon.com and affiliated sites.