yashsingh1/xdaforums huggingface dataset:
[Android General] jututt:
Tried to deodex /system/framework/framework-res.apk.

It puts framework-res.apk into the zip, but has no classes.dex inside. Actually is CRC identical to odexed version.

Also there is no sign of framework-res.apk in LOG.txt.

I think the problem here might be that this particular file "framework-res.apk" (17 MB) in my case has two odexes (and jars), "framework.odex" (9.6 MB) and "framework2.odex" (2.3 MB).

From my understanding deodexed version incorporates odex into the apk highly compressed file classes.dex and always have to be bigger in size than odexed version. Please correct me if I'm wrong.
[Android General] ShaDisNX255:
Framework-res.apk has no classes.dex (no java, no smali) it's just an apk with resources

Framework.jar (a different file) is the file that contains the classes.dex and classes2.dex after the deodexing process and is purely that, it contains no res folder.

Framework-res.apk does not get touched in the deodexing process

Framework.jar is the one that is the one that changes, so you should have two files in your fully deodexed framework folder: framework-res.apk and framework.jar

I think I'm on the right... anybody is welcome to correct me if I'm wrong
[Android General] Ticklefish:
Nope, that's right. There used to be a classes.dex file inside framework-res.apk back in the 2.x days. My first phone was on 2.1 and the APK controlled a lot more back then.

But there isn't any now. Both framework.odex and framework2.odex are for framework.jar.
[Android General] jututt:
Thank you. Didn't know that.

I checked the two generated jars, they contain classes.dex and their size is consistent with original odexes.

I installed deodexed /system/framework tru TWRP, wiped cache/dalvik.

Didn't touch /system/app and /system/priv-app (still odexed)

Now it's 5 minutes stuck at the boot logo with led flashing green/blue.

How long boot time is supposed to be in a deodexed rom after wipe cache/dalvik?
[Android General] Ouweshs28:
Nice one

Hope to use it soon

Thanks

Cheers
[Android General] Ticklefish:
It's been about two days since you posted that (sorry, I've been busy at home). I'm guessing either it booted eventually or you will have given up by now..

It shouldn't take too long on the boot logo, to be honest. If everything's working, it should go straight onto the boot animation then start processing the 'new' APK and JAR files.

If it's stuck on a blank screen, it's probably gone wrong.

When you put the framework folder on, did you wipe the original folder first? And did you set the correct permissions for each file?
[Android General] jututt:
I flashed TOAD generated zip tru recovery.

Then after boot stuck, I re-entered recovery, deleted deoxed /system/framework and adb pushed back original odexed
[Android General] Ticklefish:
Could you possibly share your framework folder and build.prop please? If you can, I'll have a look and see if I can work out what's going on.

The framework folder does seem to be difficult one in 8.0. But I'm sure we'll be able to work out a solution around it!

Oh, and does this mean the ZIP worked? It copied everything like it's supposed to?
[Android General] jututt:
I'm on stock KK 4.4 LG G2, as per my signature.

Zip worked. I'll upload framework, thanks
[Android General] jututt:
https://drive.google.com/drive/folders/1eCKFNPDDu0hy_6JTThDWnLGZCEJJOBn_?usp=sharing

my framework folder + build.prop

one question: can I partially deodex apks or must I deodex the entire folder?
[Android General] Ticklefish:
Right, give the ZIP in the download section a try. It's called "TOAD_deodex_10102018-1046.zip".

KitKat is pretty simple to deodex. All the files are in the same folder, they're not a weird format and we don't have to do anything complicated to them. So this should work..

If the ZIP doesn't work, you could try deleting the *.odex files in the framework folder and copying across the JAR and APK files from the ZIP, making sure to set the right permissions. Wipe the Dalvik cache and reboot. Your phone should then spend some time rebuilding the cache before the rom starts.

TOAD's about deodexing entire folders. But there's nothing to stop you from only using individual files from the ZIP file and using those. In fact, if you're doing that for files from the app or priv-app folders, you could just include those when you put the files into the Your_Files folder.
[Android General] jututt:
Thank you, I will try this evening.

Did you do any special trick to generate the zip or just method 19?
[Android General] jututt:
Tried now your zip tru recovery, seemed to work, wiped, booted ok, built cache, but it's not deodexed, framework is original and still has odexes and little jars.

Later I will rm framework folder in recovery and try to reflash your zip
[Android General] Ticklefish:
Hmm.

The ZIP definitely doesn't have ODEX files in it. I think I'm going to have to rethink how the ZIP works - something isn't right in there somewhere.

TOAD can deodex any combination of six folders - app, priv-app, framework, vendor/app, vendor/priv-app and vendor/framework. Currently the updater-script is supposed to work out which folders are in the ZIP, delete those from the phone and copy over the new ones. I've used the script before I created TOAD so I know it works....or it used to.

It's possible the file has corrupted somehow or saved in the wrong format or TWRP no longer accepts the same commands or something. I could create individual ZIP files for each combination of folders but I'd be looking at 30 of them which seems a little extreme. I'll have to see if I can get this sorted out.

If it's okay with you, I'll make two more ZIP's. One with a (hopefully) fixed updater-script and one with a script that just replaces the framework folder. Hopefully this will give us an idea of where things are going wrong..

Oh! Do you have busybox installed on your phone?
[Android General] jututt:
I rm * framework folder into recovery, installed your zip, checked framework folder but nothing was there. Of course reboot didn't work. Busybox installed.

Now I try to adb push back original framework but bootloops.

I also extracted deodexed files from your zip and adb pushed into framework but no luck.

What is the chmod / chown of /system/framework/ ? Mine is 0755 root root

trying to logcat in recovery, got this error

CANNOT LINK EXECUTABLE: could not load library "liblog.so" needed by "logcat"; caused by could not load library "libc.so" needed by "liblog.so"; caused by cannot locate symbol "android_get_application_target_sdk_version" referenced by "libc.so"...
[Android General] Ticklefish:
The script uses the code:

set_perm_recursive(0, 0, 0755, 0644, "/system/framework");

This sets the folders to 0755 and the files to 0644.

There's definitely something wrong with the ZIP. I think it's to do with the script, so I've made some different ZIP's with some different scripts and compression types. My idea was that it may be a problem with either the encoding or the compression.

So the ZIP's have just been uploaded to the downloads tab..

The first one is called "SimpleScriptWithCompression.zip" and has a new script. This will delete the framework folder from the phone, extract the folder from the ZIP and put that onto the phone. The script is compressed in the ZIP.

The second ZIP is called "SimpleScriptWithoutCompression.zip" and has the same script but it's not compressed.

The third is called "FullScriptWithoutCompression.zip" and uses the existing, multi-purpose script you've had before but without any compression.

Hopefully one of these will work and give you a deodexed framework. It would be great if the third one works but I can cope it's only one of the first two.

If you can try them out and let me know what happens, I'll be incredibly grateful!
[Android General] jututt:
FullScriptWithoutCompression.zip doesn't write into my /system/framework/ (odexes still there)

Other two simple scripts put deoxed and big jars, but phone bootloops.

Should I mount /system in recovery before flashing your zip or doesn't matter?

Other thing I noticed, using TWRP file manager after flashing, /system/ looks empty.

If I then reboot from recovery to recovery I see standard folder tree in /system.

Can you make a zip with my stock odexed framework, see if I can boot again? Thanks

What do you think of logcat error

CANNOT LINK EXECUTABLE: could not load library "liblog.so" needed by "logcat"; caused by could not load library "libc.so" needed by "liblog.so"; caused by cannot locate symbol "android_get_application_target_sdk_version" referenced by "libc.so"...

could be some permissions gone wrong anywhere? /system/lib currently 0777 root root, files .so present found that adb logcat not supposed to work in recovery
[Android General] Ticklefish:
So the compression didn't make a difference? But the original script still didn't work? I guess I'm going to have to abandon that then. Shame.

The script that was working looks like this:

ui_print(" ");
ui_print(" This Zip Has Been");
ui_print(" Created By");
ui_print(" TOAD ");
ui_print(" ");
ui_print(" by Ticklefish");
ui_print(" ");
run_program("/sbin/busybox", "mount", "/system");
ui_print(" Deleting Odexed 'system/framework/' Folder..");
delete_recursive("/system/framework");
ui_print(" Adding Deodexed 'system/framework/' Folder..");
package_extract_dir("system/framework","/system/framework");
delete ("/system/framework/toad_test");
ui_print(" Setting Permissions..");
set_perm_recursive(0, 0, 0755, 0644, "/system/framework");
run_program("/sbin/busybox", "umount", "/system");
ui_print(" ");
ui_print(" Flashing Complete");
ui_print(" ");
show_progress(1, 1);

I'm not really sure what's going wrong here. When you flash the ZIP, it deletes the odexed files and transfers the deodexed ones. But those files only show if you reboot to recovery from recovery? If you look with the TWRP file manager before rebooting, the whole system partition is empty? Have I understood that right?

I've uploaded a new ZIP with your odexed files and the simple script. If it doesn't work, I'm going to start screaming...
[Android General] jututt:
didn't work

I looked into /data/system/uiderrors.txt (attached)

Don't be fooled by the date 06/10/2018, it's today.

There are a lot of packages removed.

Their corresponding /data/data folder is empty.

Apk still present in /system/app or priv-app
[Android General] jututt:
Also /default.prop (attached) is wrong, says Lineage OS 7.1.2, sdk 25, don't know where it came from, never installed LOS, deleted in recovery but re-creates at boot. My rom is stock KK 4.4.2 sdk 19 that refers to recovery image
[Android General] Ticklefish:
I don't get this. The ZIP shouldn't be affecting the data partition at all. And it's certainly not doing anything to the app or priv-app folders.

I've been looking around at other deodex tools that were around when KitKat was current. I've discovered a few ways to make the code more compact, which is always nice, but the basic method is still the same. Heck, this is the method I used to deodex my phone when it was on KitKat.

So I'm a little confused.

It might be worth mounting your data partition before flashing one of those two working ZIP's. Then unmounting it afterwards.

One tool I found did this for no apparent reason. I'm not sure it'd help but it's worth a try.

About your previous post, did I read it right? You flashed the ZIP and TWRP showed a completely empty system partition? And then, when you rebooted into recovery from TWRP, the partition had everything in it again?
[Android General] jututt:
Data get mounted automatically in TWRP.

Regarding empty system partition, yes, first I mount in TWRP, see folder tree, flash zip, instead of reboot go back, explore /system, looks empty. Reboot to recovery, mount /system, everything there.

I don't want to monopolize this thread, now I need to find a way to get my device back on line, and why I got sytem packages data deleted.
[Android General] Ticklefish:
Oh, I don't mind the thread being monopolized. I just want to get this thing working. I can't see why you're getting the behaviour you are though.

Let me know if you have any luck!
[Android General] KnightRider2008:
First of all thank you for creating this tool. Unfortunately I have an issue here. I have an LG G5 with stock 8.0 and I 'm only able to fully deodex the framework folder with the 26.bat from v1.0.1.0 (the one from v1.0.1.2 won't deodex services.jar) and after that the tool always generates a zip that doesn't contain the framework and the other folders. Is there a way to edit the script in order to stop the tool from deleting the framework folder before it puts it inside the zip?
[Android General] Ticklefish:
I was doing some work on this tool earlier today and I have made some changes to the part of the code that creates the ZIP. Unfortunately the latest code is on the PC at work..

Could you share your folders and build.prop if possible please? I can try them out when I get back on Monday.
[Android General] KnightRider2008:
Thank you for looking into it. In this zip I've included the framework folder and buid.prop. If you need anything else please let me know.

https://drive.google.com/file/d/1mtyTMUFyAUq0cq-P1Qg35LExGABvc00v/view?usp=sharing
[Android General] Ticklefish:
Thank you for sharing your files. I wasn't able to extract the "lge-res.apk" from the ZIP for some reason. 7z didn't give me a specific error, it just didn't like it.

But I was able to process everything else. TOAD was able to make a ZIP with the framework folder in and all the files. It looks like I need to fix part of the code as I've got a "core-oj.jar" and a "core-oj.jar.jar" in there, but I'm not getting the behaviour you've reported.

One thing I did notice is that a lot of the VDEX in "framework/arm64" don't have matching JAR files in "framework". Which seems odd. I know different OEM's like to do different things but that doesn't make any sense to me.

I'll see if I can fix this problem with the ".jar.jar" files and upload the updated code later today.
[Android General] Ticklefish:
I've just released vs1.0.1.3 to the downloads tab. This has some slightly tweaked Methods but I've updated the code so it now makes an updater-script to match the files that have been deodexed. This should solve the issue we've been having with the ZIP's not flashing.
[Android General] abhishek.hitman:
I just tried your tool to deodex an Xperia XZ2 Premium oero firmware. It looks like the tool is trying to deodex but it does not add anything in the zip file and deletes everything in the Your Files folder.

Can you please at least give an option to stop it from deleting these files and also to choose if flashable zip is required.
[Android General] pendor24:
Hello

can you give me in pm

the part of the script and the binary, which will create the zip that I will test to see if I can help you. thank you
[Android General] KnightRider2008:
Exactly the issue I am having
[Android General] abhishek.hitman:
Also, can you please post a changelog of the versions when you have a chance.

I'm requesting this because i downloaded version 1.0.1.3 thinking that it would have Android Pie support but it doesn't based on the method files folder and you had an announcement earlier stating Android Pie support coming soon.
[Android General] pendor24:
thank you

*I'm going to look back
[Android General] Ticklefish:
I've just uploaded v1.0.1.4 to the downloads tab. This has a relatively small change from the previous version - the Your_Files folder isn't emptied during the creation of the ZIP file, and the log file is updated with the result of that creation.
[Android General] abhishek.hitman:
Hi Ticklefish, thanks for the new 1.0.1.4 update. I just tried deodexing XZ2 Premium system files again but the files in "Your_files" folder are still being deleted with no content in the zip file. :(

I don't see anything obvious in the log file as well. I have attached the log file for your reference. Do you need anything else from me to troubleshoot the issue?

Am i doing something wrong?
[Android General] Ticklefish:
You're doing nothing wrong, but I do think there's an issue with 7za.

There's no mention of 7za being used to add the files to any of your processed APK or JAR files, not even an error message. And there should be.

This is what I get:

19-10-2018@1708 --- Deodexing Process Started

ABI detected as: "arm64"
API level detected as: "26"
"26.bat" to be used

-----------

Processing file 1 of 136 - "Your_Files\app\KeyChain\oat\arm64\KeyChain.vdex"
[INFO] Processing 1 file(s) from Your_Files/app/KeyChain/oat/arm64/KeyChain.vdex
[INFO] 1 out of 1 Vdex files have been processed
[INFO] 1 Dex files have been extracted in total
[INFO] Extracted Dex files are available in 'Tool_Files'

7-Zip (A) 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18

Scanning

Updating archive C:\TOAD\Your_Files\app\KeyChain\KeyChain.apk

Compressing classes.dex

Everything is Ok

-----------

And this is what you get:

19-10-2018@1556 --- Deodexing Process Started

ABI detected as: "arm64"
API level detected as: "26"
"26.bat" to be used

-----------

Processing file 1 of 280 - "Your_Files\app\AptxNotifier\oat\arm64\AptxNotifier.vdex"
[INFO] Processing 1 file(s) from Your_Files/app/AptxNotifier/oat/arm64/AptxNotifier.vdex
[INFO] 1 out of 1 Vdex files have been processed
[INFO] 1 Dex files have been extracted in total
[INFO] Extracted Dex files are available in 'Tool_Files'

-----------

So I'm going to try something which might help. Watch this space..

Oh! Where did you put the TOAD folder on your computer?
[Android General] Ticklefish:
Right...try v1.0.1.5. I've just uploaded it to the downloads tab now.

I have a suspicion I know what's causing this issue. If I'm right, this should hopefully fix it.

Hopefully..
[Android General] abhishek.hitman:
Excellent! It works mate. I just tried it. The application creates the zip file as well as doesn't delete the contents of Your_Files folder.

I need to check the deodexed apps for correctness but this app version is working perfectly.
[Android General] KnightRider2008:
Here to confirm that build 1.0.1.5 works perfectly. I only had to delete oat folder from framework but there no other issues whatsoever. For users that may have issues with apps force closing check your logs because there is a heavy chance it has to do with missing symlinks and you may have to recreate them.
[Android General] Ticklefish:
Excellent! That is very good to hear! :highfive:

Regarding the extra oat folder, were there any files in it? I remember you had some VDEX files in framework\arm64 that didn't have any matching APK or JAR files..

Getting TOAD to recreate symlinks could be tricky. Presumably though any symlinks wouldn't be removed as we're only deleting ODEX, VDEX and OAT files. I assume the symlinks would only connect to the actual APK and JAR files.. I think..
[Android General] KnightRider2008:
Regarding the extra oat folders I found them in framework/ and priv-app/ and since I deleted them there are no issues so far. Inside the extra oat/arm64 folder in framework I found three files that seemed to be related to services.jar and they had *.art *.odex and *.vdex extensions. The oat/arm folder seemed to be untouched. I understand how difficult the addition of symlinks is as a feature to TOAD and that's why I am not asking you for it. I said about symlinks only to notify users since it seems to be a very likely cause of apps force closing so that they don't blame your tool for it. Currently I am facing another issue which is that the vendor/app files seem to be broken and I am trying to find out if deodexing went wrong with them or if they weren't unpacked properly by the script.
[Android General] KnightRider2008:
If possible a way to improve the script would be to check if the jar/apk that is about to be deodexed already has a classes.dex file in it so that it can be skipped and only have its oat folder deleted instead.
[Android General] Ticklefish:
Thank you for your hard work on this. Hopefully the issue with your vendor/app files can be easily resolved.

I've been thinking about this. We could use 7za to try to extract classes.dex from the file. If it succeeds then the file is skipped.

My only concerns are how long it would take to do the check and whether it would be needed anyway. An odexed rom shouldn't have any deodexed APK/JAR files that still have a matching ODEX/VDEX file hanging around.

But I'm certainly not saying no to implementing the check. I'm away from the computer for a week or so (taking the kids and Mrs Fish on a short break) but I can look into it when I get back.

Or...you're welcome to give it a try yourself if you want to? All you need to do is edit the batch file.. ;)
[Android General] msubhani:
Sir glad to see your tool is improved a lot. Is it possible add app/jar selection to deodex. I mean if i need few apps or jar to deodex simply i select from list. Like in TMA there is selection option for decompiling and recompiling. Thanks for your work [emoji108][emoji106]
[Android General] Ticklefish:
Shouldn't be a problem. I used to have this feature in TMA, back when that had a deodex option.

Now that I know the ZIP file is working, and the deodexing is working, I can look into that.

Let's call it a feature for v2.
[Android General] msubhani:
Thanks sir i will wait for v2. [emoji106]
[Android General] Mikanoshi:
I do :) MIUI 10.0.3.0 Android 9 ROM. Batch APKTool can deodex without device now, using built-in linux, but it's a donate version and I better would like to understand how it is done manually.

vdex -> cdex -> dex is not a problem, but what to do with all the .art/.art.rel/.oat files?

It also has some merged odexed files with boot- prefix, if you change one file there the whole thing breaks which causes either a bootloop or an endless tries by the OS to reodex the frameworks.

Complete list of framework files:

https://gist.github.com/Mikanoshi/3bd09044eed65ab6abffdad5e04d4676
[Android General] wanda agustian:
Can i use this tool for deodex samsung oreo fw with lz4 compression..?

Sorry for my bad english
[Android General] Ticklefish:
From what I understand Pie has the same basic file structure as Oreo - the main difference is the VDEX files are constructed differently and have those Compact Dex files in them. If we can process those then we're happy.

The other filetypes (art, oat, etc) can be wiped when the vdex file has been processed, most likely. It's what we do with Oreo.

As for the boot-whatever files, they all need to be done at the same time. Either it's all deodexed or none of them are.

Please don't quote the entire original post - it takes up a lot of space in the thread and isn't needed.

And yes, you can. Give it a try and see what happens!
[Android General] Mikanoshi:
Yes, I successfully deodexed the frameworks, but OS tries to deodex some system apps too for some reason and fails. System is working, but many apps force close.

I gave up and just switched to custom deodexed ROM :)
[Android General] Josevega:
Any way of running this with wine on linux ?
[Android General] Ticklefish:
I don't have Linux, aggravatingly, so I can't try it. But if you do, you're welcome to try it yourself and let me know.
[Android General] wanda agustian:
Thanks a lot, work on Samsung J5 Prime Oreo firmware:good::D. I hope you can add more feature.

[IMG="framework folder"]content://com.sec.android.app.sbrowser.FileProvider/images/share-images/15408272704881662215949556225312.jpg[/IMG]

[IMG="priv-app folder"]content://com.sec.android.app.sbrowser.FileProvider/images/share-images/1540827338858897453816616709256.jpg[/IMG]

[IMG="app folder"]content://com.sec.android.app.sbrowser.FileProvider/images/share-images/15408273741928705171555566951385.jpg[/IMG]
[Android General] Ticklefish:
That's great to hear, thank you! :good:

I'm working on version 2 right now. I'm adding an option to deodex individual files, which should prove useful.

As long as everything works out, this should only take me a few days. Hopefully..