Odex file compilation - Android N/7 - Android Q&A, Help & Troubleshooting

I'm playing around with installing apps to the system partition before first boot, using a generic installer zip(by Andybones). All I'm doing is taking the apps from /data/app and renaming their directories to something more readable, then installing them to /system/app using the installer zip and setting permissions. I've noticed that some ROMs include odex files in their system partitions, to save time on first boot.
I assume I can just transfer the odex files over with the apk's, but I remember reading that the reason apps install so much faster in Android N is that the apps are no longer fully compiled during the install, but instead do that in the background over time.
Does anyone know if this refers to the odex files? I just don't want to copy over a bunch of odex files if they're incomplete. Any help or advice would be greatly appreciated! =D

Related

[Q] Deodex my rom

Hallo guys, I trying deodex my rom a week but it did not work as well. Successful only half the rom. Please help me, I have tried many ways to including XUltimate exactly.
Rom here: http://www.mediafire.com/?qj9hllq7cp6uuqj
Sorry for ugly english
What is your phone?
If is an Motorola, here is the tutorial:
Deodexing Explained + How To
So you want to theme… but you keep hearing about all this deodexing stuff… so whats that all about?
Stock android implements an odex file structure; for every (well…most) system app(s) (.apk file) and framework files (.jar) there is a corresponding .odex file, so for example you have;
/system/app/Phone.apk
/system/app/Phone.odex
/system/framework/com.motorola.android.mediasync.jar
/system/framework/com.motorola.android.mediasync.odex
What do the .odex files do?
All of your apps on your device are packaged as .apk files; these files are compiled from google source code and can interchangeably be viewed/thought of as a compressed folder (like a .zip or a .rar); and all of your framework components (well most…) are packaged as .jar files which literally stands for Java Archive (so again this can be compared to a .zip or a .rar).
When the android OS want’s to run your apps or utilize its framework components, it has to parse (read/interpret) the compressed data held within your .apk and/or.jar files. What the odex file structure aims to do, is to expedited this process by utilizing another file (.odex file) to compliment every.apk file (and .jar file); the odex file, includes the most critical data in an uncompressed format so the android os can quickly interpret that important information before parsing through the rest of the data held within the compressed .apk files (and .jar files). So subsequently, in an .odex file structure the .apk & .jar files don’t include all of the applications/framework-components data; Essentially, two files are acting as one; for your apps there are .apk files + their corresponding .odex file and for your framework components there are .jar files + their corresponding .odex file. This works nicely as an optimized file structure, except in the circumstance when the user want’s to theme; theming requires a modification to your .apks; the image files (.pngs) held within the pngs are replaced with different ones. However it is impossible to theme an application if it exists as two files. So that is why it is said you need to be DeOdexed in order to theme; DeOdexing is the process of re-bundling that uncompressed critical data (.odex files) back into your compressed .apk (& .jar) files, so that now all of the data is included in the .apk files necessary to run your applications without the presence of .odex files; in addition all the data is now included within the .jar files necessary to utilize your framework components without .odex files. In a DeOdexed file structure, there are no odex files present.
What are the benefit’s of DeOdexing?
Simple. To be able to theme a stock ROM.
Deodexing doesn’t speed your phone up or do anything of the sort.
It is simply something that is necessary to be able to theme a stock ROM.
How do you DeOdex?
One way you can deodex is to use the application xUltimate which actually rebundles that information for you. Another way, is to use a pre-made DeOdexer Update.zip; this zip already has all the repackaged fully compressed .apk files and utilizes code in the update script to delete all of the odex files present. So essentially all it’s doing is overwriting all your old semi data inclusive .apk files with fully inclusive ones and then deleting the (now) superfluous .odex files. This is the easiest way to do it, since all the work is already done for you. Just flash it in clockwork as you would for any theme:
Download it
Place it on your sdcard
Open Droid X Bootstrap
Hit Bootstrap Recover > Ok > Reboot Recovery
Navigate to ‘Install zip from sdcard’ with volume keys and select with camera button
Navigate to ‘Choose zip from sdcard’ and select
Navigate to the directory containing the above deodexer zip
Select it > Yes
Wait for it to do its thing > reboot system
You are now deodexed.
How can you check to see if you DeOdexed successfully?
Open a file explorer (like Root Explorer or Astro)
Navigate to the directory /system/app
Check for the presence of .odex files
Navigate to the directory /system/framework
Check for the presence of .odex files
If there are no odex files present then you are deodexed!
Now you can theme!
Will DeOdexing slow you down?
Technically it should, but in actuality its really quite negligible to notice, however… In my opinion, it’s rather silly to DeOdex and stay on stock ROM; you should just make the switch to a custom ROM. Why? Because custom ROMs are already deodexed and they zipalign your apps on boot; zipaliging is the process of reorganizing the manner in which the .apk is packaged to optimized it for being parsed faster by the android OS, it is comparable if not better than the odex file structure, so you get the best of both worlds; a themed ROM and the speed of an optimized file structure. That is why Stock is lame and custom ROMS pwn (IMO of course…)

where to place apps in custom rom

Hello Guys,
I am trying to make/edit my first custom rom (forgive my noob mistakes). As base i am using the Oxygen rom. This rom has all his apps stored in system/app. I inserted an launcher(hololauncher), keyboard(custom htcime) and gallery(quickpick) apk in this folder, but after the rom is flashed these apps are causing fc's and the gallery app isnt even flashed.
I know that not every apk can be placed in the system/app folder, but how can i ensure that these apps will install correctly during flashing.
Depends on apps.
The most common mistake is forgetting to set the permissions to rw-r-r.
Also some apps need their lib files (usually end in .so) in a specific location, like quickpic that can't be turned into a system app just by putting it in system/app address.
Edit: you can ensure these apps are installed correctly by testing.
1 install them normally and convert them to system apps.
2 write down where each of their parts end up (some will always need stuff in data/app or something similar.
4 use a root explorer or adb to copy those files to your pc.
5 modify the flashable zip. Add the files you just copied and modify the updater-script to make sure those files get flashed to the correct location (you might need to include mount data commands if any of the files flash to data/)
6 test!
Some apps might require actual edition by decompiling them, but the above should work for most.
dxppxd said:
Depends on apps.
The most common mistake is forgetting to set the permissions to rw-r-r.
Also some apps need their lib files (usually end in .so) in a specific location, like quickpic that can't be turned into a system app just by putting it in system/app address.
Edit: you can ensure these apps are installed correctly by testing.
1 install them normally and convert them to system apps.
2 write down where each of their parts end up (some will always need stuff in data/app or something similar.
4 use a root explorer or adb to copy those files to your pc.
5 modify the flashable zip. Add the files you just copied and modify the updater-script to make sure those files get flashed to the correct location (you might need to include mount data commands if any of the files flash to data/)
6 test!
Some apps might require actual edition by decompiling them, but the above should work for most.
Click to expand...
Click to collapse
How can I convert it to a system app when it already is installed normally ?
I also saw the option to make a data/app folder, isn't that easier ?
(Take in consideration that I don't use kitchen or adb tools, just winrar and notepadcc )
Sent from my HTC Desire using xda app-developers app
Not talking about adb and kitchen.
there are many app managing apps out there (titanium backup, link2sd) that can convert apps to system apps.
The updater script is in META-INF of the flashable zip (can be edited with notepad).
You only need a rooted device to see where the apps keep their data and copy those files.
dxppxd said:
Not talking about adb and kitchen.
there are many app managing apps out there (titanium backup, link2sd) that can convert apps to system apps.
The updater script is in META-INF of the flashable zip (can be edited with notepad).
You only need a rooted device to see where the apps keep their data and copy those files.
Click to expand...
Click to collapse
Ok that is clear, thanks. What do you think about data/app. Will this work ?
Sent from my HTC Desire using xda app-developers app
winesh said:
Ok that is clear, thanks. What do you think about data/app. Will this work ?
Sent from my HTC Desire using xda app-developers app
Click to expand...
Click to collapse
Yeah, flashing to data app is an option, but if a data wipe or factory reset is applied after flashing the rom (to correct a bootloop for example), those apps are gone.

Symlinking native libraries (*.so files) possible?

Hello XDA xperts
I took upon myself to cook a customized rom for the company I work for. This rom is for the SGS2 phone. It is based on Deodexed Samsung 4.1.2 (XWLSD). The rom itself is ready and working. But I ran into problem after trying to include all the extra apps that must be included and pre-installed.
As you know, since the JB rom takes more system space that the SGS2 system partition has to offer, all system apk's must be symlinked to the hidden partition (Preload partition). This method works quite well. But now comes the real challenge:
If I simply copy all the extra apps apk's to /data/app and install the rom with the pre included apps, many of these apps will not work (FC). I noticed that it is because many of this apps depend on library files (*.so). If I extract these *.so files from the apk's and place them inside the rom zip file (/system/lib/*.so) the app will work fine w/o FC.
So far so good, BUT if I do this to all the extra apps, the system library will agaun exceed 512MB making the rom un installable. So moving all system apk's to Preload partition and symlinking no longer cuts it. I must move the lib folder to the preload partition and symlink all the library files.
Now I tried doing that just like I did for the system apk's, but it did not work (rom bootloops).
Is it possible to symlink the *.so files? Is there an alternative solution to my problem?
Thanks in advance

Parse error after editing apk's on samsung marshmallow devices

Heya,
A while ago, my phone, which is a samsung A3 from 2015, got an update to marshmallow.
That's cool ofcourse and it runs awesome! but I like when my phone has a nice, clean and organized system and Samsung does not do that for all apps.
What I mean is that
- Some apps are odexed, and some apps are not AND some apps are odexed, but the apk file still contains a classes.dex file.
- Some apps have a folder with libs inside the app directory, and some have this folder inside the apk file AND some have this folder inside both
So ideally, i would like all apps to follow the same structure ofcourse, which would be no classes and lib files inside the apk, and then separate oat and lib folders containing the odexes and libs.
In lollipop this was easily done by copying these files out of the apk and putting them in separate folders, then removing them from the apk itself. My phone accepted this, the apps would run as though nothing had happened and it made me feel happy
However now that i'm on marshmallow, everything i do to an apk to change it results in getting a parsing error with that apk, after which it either becomes very fragile or completely broken.
One way I have found to get around this so far is to resign the apk, but for a lot of apps resigning it makes android ignore the app completely.
So the question is...
Is there something I can change somewhere to make marshmallow act like lollipop in these cases and not care that i removed files from apk's in an attempt to odex or delib them?
Any help would be much appreciated
Further info
- I have also noticed this on an S5 / SM-G900F running marshmallow
- I have not tested this on aosp or lineage because there are no suitable roms for my phone to test this with, and I would not want to use them over stock anyway.
- I have not run into this before marshmallow, it was always fine with me editing apk's like this in older versions of android.
- I am not ready to get over my ocd and accept this :crying:
No one? I suppose it is a really tough question.
So I got around the duplication of lib files by putting the actual libs in the appname\lib\arm folder and then placing zero length lib***.so placeholder files inside the apk.
this somehow keeps the apk intact and does not cause a parse error and makes the app work as it should, even across data wipes, reboots, backups and restores.
putting zero length classes.dex files inside the apk however doesn't work. Although this also doesn't cause a parsing error, the app actually tries to transform the empty classes into dalvik cache and then it breaks.
I'm still open to better suggestions

Is it possible to flash users apps into the /data/app directory?

Hi
I'm trying to flash a couple of older devices with Lineage OS. So far I have trimmed down the OpenGApps as much as I can so that there is room for my additional apps zip archive that contains Google Play Store apk's.
The problem I have is that whilst using TWRP to flash the zip, only the '/System/App' or '/System/Priv-app' directories actually contain the freshly copied apk files, whereas the '/data/app' folder only contains empty folders named after the package names e.g. '/data/app/com.adobe.reader/' and no apk inside.
Why is TWRP only allowing me to install apps into the System directory? The user app partition is so much bigger but being able to flash them without having to install the manually via the Play Store save so much time.
Could someone shed some light on this please.
Many thanks
Will
Sent from my LG-H930 using Tapatalk

Categories

Resources