Difference Between ODEXED and DEODEXED Files - Galaxy Note GT-N7000 General

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.
Source From www.addictivetips.com

This looks to be a copy and paste from the description here.
If you are not the original author its usually a wise idea to acknowledge the original author/source.

And optimized dex files (odex files) may also depended on the framework classes interfaces. This means that you may end up with bootloops or FCs if you change the interface of framework files. The odex files have therefore been given a signature that all files must match.
Deodexed apks can on the other hand be used on several roms as they may only be depended on the resources in the framework-res.apk file.
So you can have an odexed framework with deodexed apks! But if you want to change the interfaces in the Framework then it is easier to deodex all instead of re-odex all.
Sent from my GT-N7000 using xda premium

Thanks for it! For me more clear now.

I need to verify this, So on an ODEXED STOCK ROM, Can I make changes like
editings png's inside System APK files,
Decompile and compile framework-res.apk,
Make changes to the framework-res.apk to enable crt screen effect ... ?

Clears another thing up for me...

Thank you for your post.

Sorry guys for posting a stupid question, but i'm not clear on one point.
I have the htc one S [s3]. How can I understand if /system/framework/framework-res.apk (and/or) framework-htc-res.apk are already deodexed? (in a practical manner)
I mean...since is an apk and I'm not seeing any framework-res.odex are they already deodexed?
Can I straightly modify it?
Thx in advance!

Hi... Cant cant i something? So what is better of them?
Sent from my GT-N7000 using xda premium

Emothic_Reagan said:
Hi... Cant cant i something? So what is better of them?
Sent from my GT-N7000 using xda premium
Click to expand...
Click to collapse
Is not that one is better than the other. They have different characteristiocs. Odexed are smaller and faster while deodexed are easily customizable but needs more space.
Guys I still need somebody to answer my question...plz...anybody?

Related

[SYSTEM_DUMP] True Stock up to JH7

The last time I looked, the only dump for the Captivate on xda was a JF6 version, posted a few weeks ago, and the OP had taken out a few AT&T apps prior to doing it, making it not a true stock. This morning I decided to rip out the content out of the factoryrfs.rfs files from each of the three firmwares we have. I am planning to poke around in these a bit and try my hand at some deodexing, but I have also uploaded them for anyone else to play with them, or to restore any files they might have inadvertently deleted:
Here are the links:
JF6
JH2
JH3
JH7
rajendra82 said:
The last time I looked, the only dump for the Captivate on xda was a JF6 version, posted a few weeks ago, and the OP had taken out a few AT&T apps prior to doing it, making it not a true stock. This morning I decided to rip out the content out of the factoryrfs.rfs files from each of the three firmwares we have. I am planning to poke around in these a bit and try my hand at some deodexing, but I have also uploaded them for anyone else to play with them, or to restore any files they might have inadvertantly deleted:
Here are the links:
JF6
JH2
JH3
Click to expand...
Click to collapse
What do JF and JH stand for?
freedonkey said:
What do JF and JH stand for?
Click to expand...
Click to collapse
They relate to the month in which they were built. F means june, h is august. Both of the jh roms are test roms and unfinished, but functional and snappier than the stock jf6 rom.
Sent from my Samsung SGH-i987
Thanks for this.
Aye... Thanx for the system dumps.
Anyone seen these for the i9000?
alphadog00 said:
Anyone seen these for the i9000?
Click to expand...
Click to collapse
Easy to get the files out yourself. Extract the factoryrfs.rfs file out of the firmware tar file, boot into linux and do:
sudo mount -o loop factoryrfs.rfs <any_directory_of_your_choice>
Then copy the files from the mounted location to another, and you have the raw system dump.
Pardon my ignorance but what do these dumps do/provide? How are they different from the firmware from Samsung Firmware?
glio1337 said:
Pardon my ignorance but what do these dumps do/provide? How are they different from the firmware from Samsung Firmware?
Click to expand...
Click to collapse
The firmware from Samsung Firmware contains the applications and default configuration settings packed into a factoryrfs.rfs (which itself is then inside a .tar file). That format is suitable for Odin to flash onto the phone, but you can't access the individual files inside the .rfs. What I did was to unpack the .rfs file, so that the individual files inside are available for whatever you want to do with them. These are not suitable for flashing on the phone as a whole, but someone could take something, modify it and push it to their phone, or make a custom ROM out of it. A simple example is the circle battery indicator mod, where someone modified the framework-res.apk to show percentage, and then made a custom ROM update.zip with it. Without access to the original file, this would not have been possible. Everyone has these files on the phone in one version or another (unless they manually edit or delete them). I just wanted all versions of the files ever released or leaked.
I dont know if this is the place to ask but how we can extract particular app to be able to install it as .apk
here is what i need
http://forum.xda-developers.com/showthread.php?t=776739
zagorka said:
I dont know if this is the place to ask but how we can extract particular app to be able to install it as .apk
here is what i need
http://forum.xda-developers.com/showthread.php?t=776739
Click to expand...
Click to collapse
All the apks are inside the zip files, stored the same way they would normally reside on your phone. I am pretty sure the stock Clock widget is a touchwiz widget, and will not work on your wife's Aria. Hell it won't even work on our own phone if you switch to a different launcher.
rajendra82 said:
All the apks are inside the zip files, stored the same way they would normally reside on your phone. I am pretty sure the stock Clock widget is a touchwiz widget, and will not work on your wife's Aria. Hell it won't even work on our own phone if you switch to a different launcher.
Click to expand...
Click to collapse
I am talking about ClockPackage not SamsungWidget_CalendarClock or SamsungWidget_StockClock. It's the one in applications not the widgets.
zagorka said:
I am talking about ClockPackage not SamsungWidget_CalendarClock or SamsungWidget_StockClock. It's the one in applications not the widgets.
Click to expand...
Click to collapse
Clockpackage is in the zip files. Here is the JH3 version for you. Not sure if it'll install. When I try to push to the Android 2.1 Emulator, I get:
adb install ClockPackage.apk
1404 KB/s (0 bytes in 2921292.002s)
pkg: /data/local/tmp/ClockPackage.apk
Failure [INSTALL_FAILED_MISSING_SHARED_LIBRARY]
Which tells me that the package is probably dependant on TouchWiz 3.0 or some other library already installed on the phone.
rajendra82 said:
Clockpackage is in the zip files. Here is the JH3 version for you. Not sure if it'll install. When I try to push to the Android 2.1 Emulator, I get:
adb install ClockPackage.apk
1404 KB/s (0 bytes in 2921292.002s)
pkg: /data/local/tmp/ClockPackage.apk
Failure [INSTALL_FAILED_MISSING_SHARED_LIBRARY]
Which tells me that the package is probably dependant on TouchWiz 3.0 or some other library already installed on the phone.
Click to expand...
Click to collapse
Yes, I was able to extract the .apk and .odex files but couldnt install them.
Probably you are right it is too much trouble. I'll look for some alternative.
Thank you
I think he zipaligned the system apk's too
designgears said:
I think he zipaligned the system apk's too
Click to expand...
Click to collapse
I am very new to android, so I am not sure of the implications of this. After further investigation, there is a newer version of the bat files (Auto_Deodexer_2.3), but that version does not do any zipaligning. I added my own bat file to do this after the deodexing, but is what the older version did (zip align every apk in the app directory) bad, and why? If that is the case, which of the apk files should I not zipalign?
On a similar note, the newer bat file asks me to give a bootclasspath. When I give it the values in the init.rc, it skipped deodexing few of the apks in the app directory. When I added twframework.jar to the bootclasspath ahead of framework.jar, it skipped fewer files. I am sure that the older version was buggy, and made mistakes. What should the proper bootclasspath be to not skip deodexing the following files, and to properly deodex the others:
BluetoothOPP.apk+odex
Camera.apk.odex
FactoryTest.apk+odex
MiniDIary.apk+odex
TouchwizCalendar.apk+odex
Figured out the bootclasspath to use. OP and the JH3 file updated. If you downloaded the deodexed JH3 version yesterday, please replace it with the newer version.
What exactly does deodexing and zipaligning do? I understand it makes it faster but how so?
Sent from my SAMSUNG-SGH-I897 using XDA App
frenchtoasted said:
What exactly does deodexing and zipaligning do? I understand it makes it faster but how so?
Sent from my SAMSUNG-SGH-I897 using XDA App
Click to expand...
Click to collapse
All this is highly theoretical knowlege on my part, so if anyone has better information, feel free to correct me:
Deodexing:
Some of the apks and jar files on the default stock ROM have their code split between apk/odex and jar/odex pairs instead of in a single file. This is done by the developers to supposedly save space, and memory usuage, and to speed up the booting process. Unforunately having separate odex files means that replacing any part of the whole system is much harder. Deodexing the ROM puts the code from the odex files back into the apk and jar files so that every application and jar is self contained and could be replaced with an equivalent.
Zipaligning:
Zipaligning is an optimization of apk files to align all uncompressed data within them on 4-byte boundaries to reduce the memory usage. Since deodexing rebuilt the apks with the code from the odex files, they would have become unaligned. I realigned them to make them optimized again.
This is not necessarily a performance tweak at first, but once you are able to replace the slower parts of the system as a result of it, you should start to get more benefits out of it.
would it be possible to get the allshare package from the deodexed rom? will it work with any other device?

[Q] How to edit theme images and not have phone hang on boot?

I've figured out all apk files are really just zip files, but why am I not able to unzip the framework-res.apk file, edit the images within, then save it again without causing my phone to hang on boot?
Is there some step I am missing? I've tried rezipping with normal compression, store only, and only photoshopping and resaving a single image within the apk and still it fails.
How are images edited and updated? What am I missing?
I use apkmanager myself for most theming. You might look into it
Sent from my SCH-I500 using XDA App
An apk is a zip, but it's a *signed* zip
Sent from my SCH-I500 using XDA App
Here is the way I do it. I use 7zip to do this and I think it is the only program that can do it.
The way you can do it is to extract the drawable-hdpi folder within the framework-res.apk then do all your edits and save them with the exact same file names. Then you can go back into your framework-res.apk and drag and drop the drawable-hdpi folder back in and it will over write the original ones. Now just hit the Up (like to move up a directory) button until you see the message "framework-res.apk has been changed. Update it in the archive?" then click yes. Now you can put it on your phone without force closing. If you were just editing framework-res and it was not within another .zip file then you won't get that message and that is fine.
APK Manager.
You can use extract/zip (2/3) for image-only edits, but you need to decompile/compile (9/11) to mess with xml files.
Do *not* sign system apks (like framework-res.apk). Do sign other apks.
Btw, this is in the wrong forum.
(Next step: learn about the update.zip packaging script. Remember to name it something besides update.zip afterwards, because on the Fascinate we're installing everything through Clockwork, which should be the only file actually called update.zip.)
s44 said:
APK Manager.
You can use extract/zip (2/3) for image-only edits, but you need to decompile/compile (9/11) to mess with xml files.
Do *not* sign system apks (like framework-res.apk). Do sign other apks.
Click to expand...
Click to collapse
Oooh! I didn't know this app made xml's editable. That opens up a whole new set of theming fun. I can't wait to release my new theme. It should be well received (I hope)
Btw, this is in the wrong forum.
Click to expand...
Click to collapse
I considered putting this in Themes, but this was a theme development question, so here it ended up. If the Theme and Development forums ever hook up and have a few drinks, then spawn a sub-forum, Theme Development, I assure you it would have been a much easier decision to make
Thanks everyone for helping me out. My last time playing with a phone is an old WinMo 5 device. Anroid seems limiting in it's own ways (no dedicated theme files (can't update without losing the apk theme), but much better for customizing for a 'look' of the OS.

odex helps reduce internal memory???

true that the odex offers lower booting time (when the dalvik VM first loads) and stuff but reducing the internal memory usage?? i mean wth??
it states here on this webpage - addictivetips(dot)com/what-is-odex-and-deodex-in-android-complete-guide/
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.
Click to expand...
Click to collapse
To all the newbies- a final solution to the deodex blues!
incase you guys dont know about deodex this is what it is
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.
Click to expand...
Click to collapse
so here it is and there you go you are now running around finding posts to help you deodex to get you the ultimate themeing experience well theres this guide i found out in the question and answers sub-section

Building first ROM for G900V

Good day, all!
I've been working on [my first] ROM for Verizon S5 and everything seems to be going great! I've cleaned out as much Samsung/Verizon/Google trash as I can, applied some tweaks to build.prop, changed some default apps to (IMHO) better replacements, and anything that is left (functions correctly) has been moved to /data/app so they can be Uninstalled fully (not just Turned Off). Just a few quick questions:
1) How can I "bake-in" app data? I have replaced the normal, crap launcher with Holo Launcher and cannot seem to get correct permissions when the ROM is installed thru SS. I believe the issue is permissions for /data/data/ get screwed up or not set correctly. I have looked and looked and tried to determine the correct permissions, but still no joy. I've tried to fix /data/data permissions in the updater-script, but it seems like each subfolder/file has different permissions making me think I'll have to go thru them one-by-one.
I have a work-around in place using a OneTimeInit script that does work, but it seems like that's not really the best approach?
2) Kind of ties into question number 1, I patched the framework-res.apk in to allow WiFiHotspot, but without being able to install the system settings data properly, there is not a "Quick Shortcut". Again, I've resolved the problem using the OneTimeInit to update Sqlite DBs after the system is up.
3) How do I de-odex the stock ROM? Using Android Kitchen doesn't seem to do it right. It works mostly but I still seem to get various FCs. I tend to believe that some things just cannot (should not) be De-Odex'd?
I've also discontinued Zip-Aligning because it sometimes produces errors on my ROM. Is it not advised to use Android Kitchen to do these tasks or is there some trick to getting it to work just right?
Bonus Question) I was going to share my ROM on XDA but it says I'm not allowed to post in Development. I assume because of my low post count. Any way I can get an over-ride or should I just make a few more posts and then do it?
Thanks again guys!
I appreciate all the help as always!
Jake
jake5253 said:
Good day, all!
I've been working on [my first] ROM for Verizon S5 and everything seems to be going great! I've cleaned out as much Samsung/Verizon/Google trash as I can, applied some tweaks to build.prop, changed some default apps to (IMHO) better replacements, and anything that is left (functions correctly) has been moved to /data/app so they can be Uninstalled fully (not just Turned Off). Just a few quick questions:
1) How can I "bake-in" app data? I have replaced the normal, crap launcher with Holo Launcher and cannot seem to get correct permissions when the ROM is installed thru SS. I believe the issue is permissions for /data/data/ get screwed up or not set correctly. I have looked and looked and tried to determine the correct permissions, but still no joy. I've tried to fix /data/data permissions in the updater-script, but it seems like each subfolder/file has different permissions making me think I'll have to go thru them one-by-one.
I have a work-around in place using a OneTimeInit script that does work, but it seems like that's not really the best approach?
2) Kind of ties into question number 1, I patched the framework-res.apk in to allow WiFiHotspot, but without being able to install the system settings data properly, there is not a "Quick Shortcut". Again, I've resolved the problem using the OneTimeInit to update Sqlite DBs after the system is up.
3) How do I de-odex the stock ROM? Using Android Kitchen doesn't seem to do it right. It works mostly but I still seem to get various FCs. I tend to believe that some things just cannot (should not) be De-Odex'd?
I've also discontinued Zip-Aligning because it sometimes produces errors on my ROM. Is it not advised to use Android Kitchen to do these tasks or is there some trick to getting it to work just right?
Bonus Question) I was going to share my ROM on XDA but it says I'm not allowed to post in Development. I assume because of my low post count. Any way I can get an over-ride or should I just make a few more posts and then do it?
Thanks again guys!
I appreciate all the help as always!
Jake
Click to expand...
Click to collapse
1: All I had to do was place apk in /system/app or /system/priv-app and thats it. Make sure when you add your apks you dont unzip the archive. basically use kitchen and build your base rom then simply open the archive and make your edits. I also used the updater script from beans base build and only edited the ui print.. Messing with the updater script i wouldnt recommend as it could be causing some of your issues.
2: If using beans base theres no reason for you to edit anything as the hotspot is already baked in.. you must have borked it.. If you are not using beans base then maybe you should copy his files for the native hotspot as its already done properly. I wouldnt mess with framework or settings apks unless you know what your doing. Id work on gettin the fcs n other issues sorted first as you might b doin too much too fast.. work on learning how to make your apks work first before making edits to framework n settings apks.
3: The kitchen is best to deodex and zipalign.. also these two things should not cause fcs or errors if done properly. zipalign should help more than anything.. i just like workin with deodex bcuz its easier and only one set of files instead of .apk and .odex for just bout everything..
Again, if you are not using beans bases id recommend to do so.. his bases are already deodexed have hotspot zipaligned read/write to ext sd etc.. so you wouldnt have to do all from scratch and have so many issues..
Sent from my SM-G900V using XDA Premium HD app
elliwigy said:
1: All I had to do was place apk in /system/app or /system/priv-app and thats it. Make sure when you add your apks you dont unzip the archive. basically use kitchen and build your base rom then simply open the archive and make your edits. I also used the updater script from beans base build and only edited the ui print.. Messing with the updater script i wouldnt recommend as it could be causing some of your issues.
2: If using beans base theres no reason for you to edit anything as the hotspot is already baked in.. you must have borked it.. If you are not using beans base then maybe you should copy his files for the native hotspot as its already done properly. I wouldnt mess with framework or settings apks unless you know what your doing. Id work on gettin the fcs n other issues sorted first as you might b doin too much too fast.. work on learning how to make your apks work first before making edits to framework n settings apks.
3: The kitchen is best to deodex and zipalign.. also these two things should not cause fcs or errors if done properly. zipalign should help more than anything.. i just like workin with deodex bcuz its easier and only one set of files instead of .apk and .odex for just bout everything..
Again, if you are not using beans bases id recommend to do so.. his bases are already deodexed have hotspot zipaligned read/write to ext sd etc.. so you wouldnt have to do all from scratch and have so many issues..
Sent from my SM-G900V using XDA Premium HD app
Click to expand...
Click to collapse
Thank you for the response!
It seems perhaps I didn't quite make clear what I've done versus what I'm trying to accomplish.
Firstly, I wouldn't go so far as to say I'm "having so many issues". Everything in my ROM is in perfectly fine working order. I just have these few quirks that I would like to address both so I can learn, and to make this and future projects better.
While I appreciate the recommendation to use bean's base, I have taken a look at his and there seems to be nothing in his which copies data into /data/data/com.whatever.package (or at least there's nothing in his zip in the /data/data folder -- not sure if his ROM has the toggle activated?)
I have the Apps working correctly in my ROM -- they just go in /data/apps, /system/app or /system/priv-app, respectively.
What I need, is to get /data/data/com.whatever.package/ copied With Correct Permissions when the ROM is installed; I do not want a second zip to update things after install, especially for a toggle and a couple shortcuts, seems silly.
For instance, when you boot your phone up with the default [stock] samsung launcher, it has a list of default apps and widgets on the first screen you see such as phone, messages, a clock widget, etc, etc. Since I've replaced the stock launcher with Holo Launcher HD and some other default apps have also been replaced, there's very few shortcuts on the main launcher screen.
** Holo Launcher does have a list of default apps it adds to your main page, but many of those have been removed in my rom.
The solution I've come up with basically waits for the system to boot up to the point that Holo Launcher actually creates the default (mostly blank) /data/data/com.mobint.hololauncher.hd/databases/launcher.db and then my script uses sqlite3 to update the DBs with a list of different shortcuts -- ones to apps that actually exist.
The Hotspot Toggle is the same way as above.. Hotspot works fine in my rom if you go through settings!
I just cannot add the notification panel pull-down toggle to /data/data/com.android.providers.settings/database/settings.db until after the system boots up at least ONE time, and then update the DB to include WiFiHotspot in notification_panel_active_app_list and notification_panel_active_app_list_for_reset
As for the zipalign and deodexing, I will have to try those again now that I have a fairly stable rom.
****EDIT****
I think I figured it out. I can just use busybox to kill the systemui after I update the databases during the first boot. I also figured out how I can add the SetupWizard without it locking up on activation.
Thanks anyways, guys.
Look for my rom, coming soon!
=P
Please add support for more languages
I found a mod for Motorola latest 4.4 please port it
Sent from my SM-G900T using XDA Free mobile app

What is the correct procedure for decompiling system APKs?

Hey guys.
Having some difficulty here with modifying system APKs without leaving them 'corrupt'.
Specifically with SecSettings and SamsungCamera6.
Only looking to simply modify the qmg icons for the time being.
Ticklemyandroid didn't really want to know with SecSettings. Tried using apktool manually after installing the framework-res.apk and still doesn't seem quite right. Also tried apk multi took. Even went as far as simply trying to past the qmg files into the existing APK with winrar but that really broke things.
I believe my issue is partly that things aren't decompiling properly, but also that I'm a little unclear of the correct procedure to recompile them afterwards without any errors or corruption if tapping on them to install (I'm not actually trying to install them this way, but I'm looking to get to package conflicts rather than package corrupt).
Edit: NVM. Seems like some kind of protection to prevent you from modifying and installing said APKS

Categories

Resources