[Q] deodexing and checking - HTC One S

Hi All,
I'm currently trying to deodex my rom to fully customize it. I have HTC One SU with chinese firmware and want to add more languages, for example and patch some smali files.
I already deodexed framework and it seems working good, but stucked on /system/app
Deodexing works without any errors and smoothly
But some apps working well, some completely not. After replacing some apks I see errors on screen and in logcat. After reboot system stucks on boot animation and I have to restore from last backup.
So I expect, classes.dex after odexing by the system should be completely the same as original classes.odex
talking on programming language: Original classes.odex == system_odexed(custom_deodex(Original classes.odex ))
is it should be like that? is statement correct?
or everytime I odexing or deodexing files, result of back step will not always equal to original source?
Question 2: which framework I should use to deodex system/app ? ODEX or DEX?

Falseclock said:
Hi All,
I'm currently trying to deodex my rom to fully customize it. I have HTC One SU with chinese firmware and want to add more languages, for example and patch some smali files.
I already deodexed framework and it seems working good, but stucked on /system/app
Deodexing works without any errors and smoothly
But some apps working well, some completely not. After replacing some apks I see errors on screen and in logcat. After reboot system stucks on boot animation and I have to restore from last backup.
So I expect, classes.dex after odexing by the system should be completely the same as original classes.odex
talking on programming language: Original classes.odex == system_odexed(custom_deodex(Original classes.odex ))
is it should be like that? is statement correct?
or everytime I odexing or deodexing files, result of back step will not always equal to original source?
Click to expand...
Click to collapse
What API did you deodex them with?
Sent from my HTC One S using xda app-developers app

troby86 said:
What API did you deodex them with?
Click to expand...
Click to collapse
manually )) This is perfectly works for framework jars
just 4 commands (simplified here and of course I have my automatic script)
java -Xmx1024m -jar baksmali.jar -c <<BOOT_PATH_HERE>> -x classes.odex
java -Xmx1024m -jar smali.jar out -o classes.dex
7z.exe a -tzip my_programm.apk classes.dex
zipalign -v 4 my_programm.apk zip_my_programm.apk

Question 2: which framework I should use to deodex system/app ? ODEX or DEX?

Falseclock said:
Hi All,
I'm currently trying to deodex my rom to fully customize it. I have HTC One SU with chinese firmware and want to add more languages, for example and patch some smali files.
I already deodexed framework and it seems working good, but stucked on /system/app
Deodexing works without any errors and smoothly
But some apps working well, some completely not. After replacing some apks I see errors on screen and in logcat. After reboot system stucks on boot animation and I have to restore from last backup.
So I expect, classes.dex after odexing by the system should be completely the same as original classes.odex
talking on programming language: Original classes.odex == system_odexed(custom_deodex(Original classes.odex ))
is it should be like that? is statement correct?
or everytime I odexing or deodexing files, result of back step will not always equal to original source?
Question 2: which framework I should use to deodex system/app ? ODEX or DEX?
Click to expand...
Click to collapse
Use this it will work like a charm for that..just don't forget to check updater-script after.. If it won't flash after the kitchen the spacing is wrong in the script..
http://forum.xda-developers.com/showthread.php?t=633246
Sent from my HTC One S using xda premium

Iw would like to deodexing my stock rom but the Android-Kitchen doesn't find my TWRP Back-Up gives a another way to deodex my Sense Stock Rom?
xUltima doesn't work.

Related

Auto-Deodexer 2.3 [SCRIPT] [FROYO SUPPORT] [Devs Only]

Hey guys, so this script de-odexe's a rom's apks and jar's.
Many thanks to ofcourse JesusFreke who created this method and the way to do it. Also to coolbho for his apkopt script from which i learnt certain techniques of batch programming. This is crzyruski script updated with jesus freke's latest smali/baksmali update ver 1.2.3
It incorporates detecting the bootclasspath of the odex instead of the user specifying it. For non standard odex however a specific bootclass path must be defined. For example:
According to Jr33 for rosie deodexing u have to add class paths com.htc.framework.jar. Thank him for the new Sense bootclasspaths
For those who dont know, this essentially uses jf's method of baksmali'ing the odex file into smali files, and then recreating the classes.dex file and packaging it into the apk hence disregarding the need for the odex.
*New Menu added
*Ability to specify custom bootclasspath (eg for sense ui)
*Added a java check at the beginning
*Added 1.2.3 smali/baksmali with froyo support(thank jf ofcourse )
*Modified it so if an error is encountered during deodexing, it leaves that file behind so once done you know what files encountered errors
*Added Ignore Mode
*Removed zipalign
*If apk doesnt have corresponding odex, it moves it to deodexed_APK instead of user manually moving it
*Added compression level option
*You can monitor the status of ignore mode / compression level right above the main menu
DISCLAIMER:
Its a batch file so it'll only work on windows.
Convince farmatito to bring this to linux
Thanks
So I checked this out and all ...
It's only apk's, right?
I only glanced but I didn't see anything in there for framework, etc.
If I'm right, then perhaps .. you should just say it de-odex's a ROM's apk's instead of the entire ROM.
~enom~
enomther said:
So I checked this out and all ...
It's only apk's, right?
I only glanced but I didn't see anything in there for framework, etc.
If I'm right, then perhaps .. you should just say it de-odex's a ROM's apk's instead of the entire ROM.
~enom~
Click to expand...
Click to collapse
Oh, yea so it takes the apk and odex and creates the classes.dex and repackages into the apk so u only need the apk. Ok, ill change the post a bit also yes, it doesnt do frameworks cuz i dont think they have odex's and the jar's do but i dunno of a method to do tht
Daneshm90 said:
Oh, yea so it takes the apk and odex and creates the classes.dex and repackages into the apk so u only need the apk. Ok, ill change the post a bit also yes, it doesnt do frameworks cuz i dont think they have odex's and the jar's do but i dunno of a method to do tht
Click to expand...
Click to collapse
Yea ... the jar's have dex's too and can be odex-d and can also be un-odex-d. I personally have never been able to successfully de-odex a fully odex'd framework (but I haven't tried hard enough either ). The main difference is once they are de-odex'd ... you insert the classes.dex into the jar and no re-signing required (as they aren't signed).
Either way, nice script mate. Good Job!
~enom~
enomther said:
Yea ... the jar's have dex's too and can be odex-d and can also be un-odex-d. I personally have never been able to successfully de-odex a fully odex'd framework (but I haven't tried hard enough either ). The main difference is once they are de-odex'd ... you insert the classes.dex into the jar and no re-signing required (as they aren't signed).
Either way, nice script mate. Good Job!
~enom~
Click to expand...
Click to collapse
Ah sweet, something i shall incorporate in the script later on. thanx
so will this script allow you to take an app from say a cliq dump and allow it to run on any android device?
Will this allow you to grab the MyFaves from a TMO rom and de-odex it and install?
Joe333x said:
so will this script allow you to take an app from say a cliq dump and allow it to run on any android device?
Click to expand...
Click to collapse
Emm...no im 99.99% sure it doesnt help tht way. I know that odex's cause customization problems in roms....there are other factors im sure
mrandroid said:
Will this allow you to grab the MyFaves from a TMO rom and de-odex it and install?
Click to expand...
Click to collapse
MyFaves == No Go ... it requires some other form of trickery ... I'm not sure what exactly ... as I did de-odex it and it would not work properly on test-key ROM's like CM, etc.
... So it requires more than a simple de-odex.
~enom~
does your phone need to be connected? I noticed some ADB commands in the script
Daneshm90 said:
Hey guys, so this script de-odexe's a rom's apks.
Many thanks to ofcourse JesusFreke who created this method and the way to do it. Also to coolbho for his apkopt script from which i learnt certain techniques of batch programming
For those who dont know, this essentially uses jf's method of baksmali'ing the odex file into smali files, and then recreating the classes.dex file and packaging it into the apk hence disregarding the need for the odex.
Oh also make sure to place only apk's that have their corresponding odex's. Dont place only apk's !!!!!
Instructions:[WINDOWS ONLY & Phone Must stay connected with adb WORKING]
1. Download http://www.mediafire.com/?mwownkhzm4m
2. Extract to a folder
3. Place all your rom's apk's which have odex's attached to them into that folder
4. Run deoall
5. Copy all the apk's from the deodexed folder into ur corresponding rom app folder
Thanks
Upcoming:
Seperate Framework & apps folder
De-odex framework apk's and jar's (thanx for the tip enomther )
Click to expand...
Click to collapse
So the apk after that has the DEX built in or is dexopt still needed?
wesgarner said:
So the apk after that has the DEX built in or is dexopt still needed?
Click to expand...
Click to collapse
>.<.......................
kingklick said:
>.<.......................
Click to expand...
Click to collapse
Hey I am just double checking
If you're having problems de-odexing the framework is because there's a particular order to it.
If you look at your bootclasspath you'll see the framework files necessary to boot the android system, the rest (whatever's not in there) can be dexopted in any order.
If you're trying to de-odex the framework, you're going to have to backtrace yourself.
Personally, I do:
for i in /system/app/*.apk
unodex
for j in /system/framework/nonCoreJar1.jar /system/framework/nonCoreJar2.jar /system/framework/...nonCoreJarN.jar
unodex
for k in /system/framework/bootClassPathJarN.jar /system/framework/bootClassPathJarN-1.jar /system/framework/...bootClassPathJarN-y.jar
unodex
it requires a couple of reboots along the way to deal with any created dalvik-cache so that it doesn't interfere with the next needed classes.dex
the only turn-off was that it requires a running system to do it (it's not that big of a problem, but porting and then flashing starts getting old after a while).
Has that changed?
Does OP mean you can take the apks, toss them into a folder, and then do it from the computer without the phone?
---edit---
shoot me for not reading.
Daneshm90 said:
Instructions:[WINDOWS ONLY & Phone Must stay connected with adb WORKING]
Click to expand...
Click to collapse
jubeh said:
If you're having problems de-odexing the framework is because there's a particular order to it.
If you look at your bootclasspath you'll see the framework files necessary to boot the android system, the rest (whatever's not in there) can be dexopted in any order.
If you're trying to de-odex the framework, you're going to have to backtrace yourself.
Personally, I do:
for i in /system/app/*.apk
unodex
for j in /system/framework/nonCoreJar1.jar /system/framework/nonCoreJar2.jar /system/framework/...nonCoreJarN.jar
unodex
for k in /system/framework/bootClassPathJarN.jar /system/framework/bootClassPathJarN-1.jar /system/framework/...bootClassPathJarN-y.jar
unodex
it requires a couple of reboots along the way to deal with any created dalvik-cache so that it doesn't interfere with the next needed classes.dex
the only turn-off was that it requires a running system to do it (it's not that big of a problem, but porting and then flashing starts getting old after a while).
Has that changed?
Does OP mean you can take the apks, toss them into a folder, and then do it from the computer without the phone?
Click to expand...
Click to collapse
Yea I would figure as much ... simply b/c one must follow the BOOTCLASSPATH order when odex'ing ...
So Jubeh .. you're saying you've personally de-odex'd an fully odex'd framework b4?
Just looking for confirmation from someone who has personally ... since I'm too lazy to go through that hectik crappy process
~enom~
enomther said:
Yea I would figure as much ... simply b/c one must follow the BOOTCLASSPATH order when odex'ing ...
So Jubeh .. you're saying you've personally de-odex'd an fully odex'd framework b4?
Just looking for confirmation from someone who has personally ... since I'm too lazy to go through that hectik crappy process
~enom~
Click to expand...
Click to collapse
I did it with the tattoo build, but upon boot I would get all sorts of fc's, but I think that was due more to a bad, hasty port than the deodexing. It was also a long time ago when the tool first came out, dont know if there's been newer revisions, so I'll try it again on that funky tattoo rom.
K guys one problem i found after doing multiple apk's is that i need to give the listening dex command a bit delay so its ready for baksmali. I was doing it right after which it misses for some conversions. I'll upload with delay between the two commands. Hmm framework i gotta give a shot :/ Sounds interesting ...
Solid script! Should make deodexing A LOT easier
Ok so i uploaded with delay between, seems to work fine, tested a LOT of times
thanks for this! can't wait for frameworks to be de-odexed.
jubeh: Thanks for the info. I had no idea and have informed JF previously here: http://jf.andblogs.net/2009/11/08/smalibaksmali-v1-0/ (see comments)

[DUMP] Deodexed APKs from 1.32 rom

As title says.
I needed this files, so why not share them. Maybe someone will need them.
They are from latest 1.32 rom.
Archive contains both signed and unsigned files...
http://www.filefactory.com/file/b417bhc/n/app.rar
Thank you very much should come in handy if and when I need them
Doktaphex said:
Thank you very much should come in handy if and when I need them
Click to expand...
Click to collapse
I'm not sure if it's not necessary to deodex framework files as well? I tried to do that but deodexing framework gives many errors. I wonder why because when I was deodexing framework from Desire everything was fine...
android.policy.odex and services.odex are impossible to deodex....
mike1986. said:
I'm not sure if it's not necessary to deodex framework files as well? I tried to do that but deodexing framework gives many errors. I wonder why because when I was deodexing framework from Desire everything was fine...
android.policy.odex and services.odex are impossible to deodex....
Click to expand...
Click to collapse
Missing classes mate, aint had chance to test it yet but you sould be able to use -i to ignore them, its pretty common in htc roms.
Mine is arriving between 2-3pm gmt
Swiped from my LeeDrOiD loaded HTC Desire using my thumb....
I got your dump files, thanks.
How can i deploy them on device?
Device is already root and everything, Rom manager installed

[MOD] Deodexed XXKB3 with VANILLA Lockscreen for I9003!

Based on I9003XXKB3 firmware, I made this mod also for our phone...
How to install:
- unpack the archive and copy the two folder to sdcard ( you must have /sdcard/done_app and /sdcard/done_frame)
- with you pc get an adb shell and type:
su
mount -o remount rw /system
rm /system/app/*.odex
cp /sdcard/done_app/* /system/app
rm /system/framework/*.odex
cp /sdcard/done_frame/* /system/framework
reboot
Important:The first time the phone maybe won't boot so: unplug the battery and restart...and be patient!
DOWNLOAD HERE
P.S.: for the people that don't like the deodexed app but that have the I9003XXKB3 firmware installed I post also an archive with two files. Simply overwrite the originals in /system/framework/ (also with root explorer)and reboot. The first time the phone maybe won't boot so: unplug the battery and restart...and be patient!
EDIT: The two files contain a mistake so i removed they... sorry.... only apply the first guide!
Let me know what you think.... bye
Ohhh... Basically its a deodexed apk and jar with a different lock screen. I too have deodexed my fw xxkb3. But for Lock screen you can get applications from market. No offence, I respect your work, its a good beginning. Sorry, but I thought initially its with vanilla kernel.
Sent from my GT-I9003 using XDA Premium App
Skin1980 said:
P.S.: for the people that don't like the deodexed app but that have the I9003XXKB3 firmware installed I post also an archive with two files. Simply overwrite the originals in /system/framework/ (also with root explorer)and reboot. The first time the phone maybe won't boot so: unplug the battery and restart...and be patient!
Let me know what you think.... bye
Click to expand...
Click to collapse
I've tried odexed android.policy and now I'm reflashing phone: It became always rebooting during the boot.
falex007 said:
I've tried odexed android.policy and now I'm reflashing phone: It became always rebooting during the boot.
Click to expand...
Click to collapse
You have a risk of boot loop with Framework related files if there is any incompatibility or improper file replacement. Any time you try such items be ready to reflash. What is your Firmware? Is it XXKB3? If yes then it should work as per Skin 1980, but it wont work on other firmware unlike system/app apks.
trip007in said:
You have a risk of boot loop with Framework related files if there is any incompatibility or improper file replacement. Any time you try such items be ready to reflash. What is your Firmware? Is it XXKB3? If yes then it should work as per Skin 1980, but it wont work on other firmware unlike system/app apks.
Click to expand...
Click to collapse
Yes. I have XXKB3. And I am not afraid to reflash I did this several times (first to upgrade from XXKB1, then to remove OCLFv1, and so on ) All my settings/applications are saved to Dropbox with help of Titanium backup
Nice work dude
Thanks a lot. Deodexed applications works well. Also I like standard lock screen
Please fix your instruction:
cp /sdcard/done_frame /system/framework
to
cp /sdcard/done_frame/* /system/framework
BTW After start it showed 318M of free memory, with standard fw I saw ~270M. But I thought that it should use more memory (not lesser). This is strange for me
falex007 said:
Thanks a lot. Deodexed applications works well. Also I like standard lock screen
Please fix your instruction:
cp /sdcard/done_frame /system/framework
to
cp /sdcard/done_frame/* /system/framework
BTW After start it showed 318M of free memory, with standard fw I saw ~270M. But I thought that it should use more memory (not lesser). This is strange for me
Click to expand...
Click to collapse
Thanks.... I have edited the post....
Can you upload to multiupload
megaupload block my area...
Dello i see from the snapshot that you are italian... It istituto true?you have problems with xx b3 deodexed or not ? How is gps working ?
Inviato dal mio GT-I9003 usando Tapatalk
Hi!
I am on ddkb2 and just want the lockscreen! What do i exactly have to do to just get the vanila lockscreen
Thanks dude, used your framework files for the vanilla lock. But why did you remove those framework.apk files? I noticed those missing files during flash and added my own deodexed apks. Worked great.
Sent from my GT-I9003 using XDA Premium App
I don't remove framework-res.apk.... simply it cannot be deodexed cause it doesn't have odex file.... correct me if i'm wrong
trip007in said:
Thanks dude, used your framework files for the vanilla lock. But why did you remove those framework.apk files? I noticed those missing files during flash and added my own deodexed apks. Worked great.
Sent from my GT-I9003 using XDA Premium App
Click to expand...
Click to collapse
Sent from my GT-I9003 using XDA App
Update to kb3, root your device and follow the guide on the first post... pm if you need help..... bye
ritvik93 said:
Hi!
I am on ddkb2 and just want the lockscreen! What do i exactly have to do to just get the vanila lockscreen
Click to expand...
Click to collapse
Sent from my GT-I9003 using XDA App
Who said no odex files dude? just check the stock firmware or ask someone who is running stock firmware to check in the /system/framework. There are 24 files after deodexing the framework folder, before deodexing you have 46 files. Attached screen shot here. I have highlighted the apk and corresponding odex files from framework folder.
Skin1980 said:
I don't remove framework-res.apk.... simply it cannot be deodexed cause it doesn't have odex file.... correct me if i'm wrong
Sent from my GT-I9003 using XDA App
Click to expand...
Click to collapse
Please.... check inside the related jar file on my deodexed file and you will find where the odex is....tell me if i'm wrong
Sent from my GT-I9003 using XDA App
Skin1980 said:
Please.... check inside the related jar file on my deodexed file and you will find where the odex is....tell me if i'm wrong
Sent from my GT-I9003 using XDA App
Click to expand...
Click to collapse
No dear, I am talking about the two apk files in framework folder which are not included in the jar folder. framework-res.apk and twframework-res.apk are the two files. If you are using the application Deodexer_2_3 for deodexing framework files, it creates two folders one for jar files as deodex_jar and another for apk files as framework. Just check in the that folder you will find them.
When I transferred those deodexed files to /system/framework from downloaded files uploaded by you. I used an adb command
Code:
rm /system/framework/*.odex
. This means my system will never reboot without those odex files of above mentioned apks, if did not replace them with deodexed ones. Hope I am clear now. If you guys check in your framework folder you will find two odex files which you have not replaced. Please dont take is as an offense, I love your work.
What i wrote in the first post is what i've done on my phone that works correctly.... sure that the files i attached are not all the files that must be in the system and framework folders.... this because it's simply an "update" to stock rom.
Another thing... no problem with you my friend... we are working all for the same result...
P.s.: framework-res.apk and the other cannot be deodexed i supposed cause the related odex files will be put by the deodex-software into the related .jar files.... check into your framework-res.apk .
Sent from my GT-I9003 using XDA App
No dear, I am sorry to say but you are wrong here. every .apk and jar has their own odex files so the odex resides inside the respective apk or jar file that it belongs to after deodexing them. If you want I can attach those two deodexed framework apk files, which should go into /system/framework folder along with remaining jar files, (without their odex files). Will post tomorrow morning here you may link them to the main post, if you feel so. If I do something, I am never satisfied by incomplete job.
Skin1980 said:
What i wrote in the first post is what i've done on my phone that works correctly.... sure that the files i attached are not all the files that must be in the system and framework folders.... this because it's simply an "update" to stock rom.
Another thing... no problem with you my friend... we are working all for the same result...
P.s.: framework-res.apk and the other cannot be deodexed i supposed cause the related odex files will be put by the deodex-software into the related .jar files.... check into your framework-res.apk .
Sent from my GT-I9003 using XDA App
Click to expand...
Click to collapse
trip007in said:
No dear, I am sorry to say but you are wrong here. every .apk and jar has their own odex files so the odex resides inside the respective apk or jar file that it belongs to after deodexing them. If you want I can attach those two deodexed framework apk files, which should go into /system/framework folder along with remaining jar files, (without their odex files). Will post tomorrow morning here you may link them to the main post, if you feel so. If I do something, I am never satisfied by incomplete job.
Click to expand...
Click to collapse
Maybe i don't explain myself very well... tomorrow i will try to explain better what i'm saying... see you!
Sent from my GT-I9003 using Tapatalk

How to re-odex?

Normally to decompile my dex files I use smali and baksmali, how can I re-odex them?
Id like to get my service.jar re-odexed so I can try and push it to my phone via a zip update.
Sent from my MB865 using xda premium
[mini HOW-TO] Re-Odex (or create a new .odex file)
Fall of Enosis said:
Normally to decompile my dex files I use smali and baksmali, how can I re-odex them?
Id like to get my service.jar re-odexed so I can try and push it to my phone via a zip update.
Sent from my MB865 using xda premium
Click to expand...
Click to collapse
It all needs to be done on your phone, live.. with adb.
Here's how I accomplished it - I will use the services.jar in this example. Just change the file name and path to existing .odex accordingly for other files (not sure if all steps are required exactly, but it has worked for me multiple times with different jars and SysUI apk):
Requirements:
Odexed system
adb
dexopt-wrapper
Put this dexopt-wrapper file (unzip first) in /system/bin with 775 permissions:
X X X
X....X
X....X
Probably a good idea to reboot after pushing that file, if you use root explorer (like I did).
Put the deodexed services.jar (or other jar/apk file you want to make an new odex of) on your sd card.
Go to /system folder (with root explorer or equal) and mount it R/W (not sure if this is necessary - but won't hurt)
Put your USB connection to "Charge only" mode.
Go here (big props and credit to jhotmann for this) and follow steps 8-12 (I've recreated the steps with the A2's bootclasspath below).
The bootclass path is located in the /init.rc file at the root of your phone.
Connect with adb (do a adb devices check to make sure you're all good).
To create the new odex:
Code:
adb shell
su
cd /sdcard/
dexopt-wrapper services.jar new.odex /system/framework/core.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar:/system/framework/core-junit.jar:/system/framework/com.motorola.android.frameworks.jar:/system/framework/com.motorola.android.widget.jar
I know it's a long entry for those who don't work with command lines often (like me), but double check your entry before hitting enter.
To copy the signature from the existing odex (change path to /system/app/.. if necessary):
Code:
busybox dd if=/system/framework/services.odex of=new.odex bs=1 count=20 skip=52 seek=52 conv=notrunc
Done! Rename new.odex (created on your /sdcard) to services.odex since that is your new signed odex file...
You can then get that on your odexed system by your choice of method (adb push, update.zip, root explorer push, etc.. - note: please know what you are doing before trying to push files with root explorer! - you cannot simply copy and paste!)
Or, if you want to deodex it right away again for some odd reason like I did (personal issues )... Take the services.jar and the new services.odex from your sdcard and put them on your computer - and open the services.jar with 7-zip (maybe winzip) and delete the classes.dex file from the 7-zip window. Now you have a fresh new set of .jar/.odex files ready for deodexing (I did this all with the SystemUI.apk last night, that's why I elaborated and re-typed this whole thing today..).
Frigging brilliant man.
Much appreciated. I'm super sick and my USB cable is at work.
Once i get it back on Wednesday, I'll work all this out. If I could thank you twice I would.
Thanks man!
Sent from my MB865 using xda premium
Fall of Enosis said:
Frigging brilliant man.
Much appreciated. I'm super sick and my USB cable is at work.
Once i get it back on Wednesday, I'll work all this out. If I could thank you twice I would.
Thanks man!
Sent from my MB865 using xda premium
Click to expand...
Click to collapse
Not a prob.
And, I updated the dexopt-wrapper link so it's easier to download - just unzip it first..
Good luck on your quest.. let me know if you catch any snags along the way - and i'll try and help you out.
Sent from my mind using XDA
Ok sooo, I think we (or most likely me) are confused on what I wanted to do. I don't want to make a NEW odex file. I need to recombine my modded classes.dex BACK with the service.jar.
Since I needed to modify some script in the services.jar I had to de-odex it so I had a classes.dex file to use baksmali with so I could modify it. Once I modded it I used smali to create the NEW MODDED classes.dex. And now I need to re-odex(bad terminology?) them to re-combine the services.jar with the classes.dex so the modded services.jar could be used on a odexed ROM.
I'm working on a de-odexed version also, but I'd like to be able to offer both
Fall of Enosis said:
Ok sooo, I think we (or most likely me) are confused on what I wanted to do. I don't want to make a NEW odex file. I need to recombine my modded classes.dex BACK with the service.jar.
Since I needed to modify some script in the services.jar I had to de-odex it so I had a classes.dex file to use baksmali with so I could modify it. Once I modded it I used smali to create the NEW MODDED classes.dex. And now I need to re-odex(bad terminology?) them to re-combine the services.jar with the classes.dex so the modded services.jar could be used on a odexed ROM.
I'm working on a de-odexed version also, but I'd like to be able to offer both
Click to expand...
Click to collapse
So, you have a deodexed services.jar (with an unedited classes.dex inside)? And, you also have an edited classes.dex (the new modded one). Just drag and drop the new modded classes.dex into the services.jar file with 7-zip to overwrite the old one.
Then I would check out the mods on a deodexed system, and provided they work, then go through the re-odexing process (separating that classes.dex from the apk and creating a new odex file) as described above to get it working on odexed systems.
Hope that helps.. Good luck!
Yes sir, you are correct. That was the first thing I tried to do was just drag and drop the modded classes.dex with 7zip, save it, however when i tried to flash the "modded" ROM it can't install the system folder because (according to Jim), when I modded copied the new classes.dex, I changed the size, and so the signature needed to be changed as well. They mismatched.
Fall of Enosis said:
Yes sir, you are correct. That was the first thing I tried to do was just drag and drop the modded classes.dex with 7zip, save it, however when i tried to flash the "modded" ROM it can't install the system folder because (according to Jim), when I modded copied the new classes.dex, I changed the size, and so the signature needed to be changed as well. They mismatched.
Click to expand...
Click to collapse
Not sure about the details of that.. I know the signatures can be tricky, but I've modded a few apks/jars similarly with no problems... when you say "can't install.." is that it wouldn't flash in recovery, or you bootlooped?
Just wouldn't flash at all.
And thanks for all your help man.
Sent from my MB865 using xda premium
I've updated the 2nd post with more detail on creating a new odex file...
Not to be a "rooster" (replace with your word of choice) or anything, but maybe this info has a place somewhere besides the general threads..?:angel: (and what is up with these new Smilies and posting reply layout?) - it just seems so hard to come by good literature on this process (which, I suppose, is a process so rarely needed though...)
So I need to perform the processes above while running in an odexed environment correct? Does this process change the deodexed APK we are running the script on to an odexed one as well as create a new .odex file for that APK? I am just confused about what the result is after running the script. For my situation I want to take 2 deodexed files (systemui and sec settings.apk) and odex them. Then push them into an odexed rom. Once I run the script above what am I left with?
Didact74 said:
So I need to perform the processes above while running in an odexed environment correct?
YES.
Does this process change the deodexed APK we are running the script on to an odexed one as well as create a new .odex file for that APK?
(Yes, it will create a new odex file that you will need to rename, but..)NO. You will need to take the classes.dex out of the deodexed apk/jar - use something like 7-zip. Unless you only edited smali, then you really only need the new odex file.
I am just confused about what the result is after running the script. For my situation I want to take 2 deodexed files (systemui and sec settings.apk) and odex them. Then push them into an odexed rom. Once I run the script above what am I left with?
Click to expand...
Click to collapse
I broke up your quote with my best answers...
As for what your're left with is a new.odex file, properly signed, if all goes well. You are going to need to do it for each of your deodexed files.
Rename them, remove the classes.dex from the deodexed files you used, and get them on your phone however you choose (I prefer zip packages and a restore.zip in case something goes wrong).
Also note that the bootclass path is different from GB to ICS.. and among different devices of course. Check init.rc file if need be. I posted the one to use for A2 ICS (think it may be the same for razr too) here: http://forum.xda-developers.com/showthread.php?t=1753659
I can't garuntee you won't have problems, but good luck... if you do you could try the dexopt-wrapper from here: http://forum.xda-developers.com/showthread.php?t=1645950 - just unzip it first obviously (but I think it's the exact same file though..)
Btw, it's all done with adb, one line at a time.. not really a script, but thank you for the idea - maybe a batch file?
Sent from my phone's mind
Great, thank you for the detailed response. Last question.
What if I have the original SystenUI.odex and SecSettings.odex files that used to be attributed to them before i deodexed them? Can I simply reuse those without having to run through the adb process?
Thanks,
Didact74 said:
Great, thank you for the detailed response. Last question.
What if I have the original SystenUI.odex and SecSettings.odex files that used to be attributed to them before i deodexed them? Can I simply reuse those without having to run through the adb process?
Thanks,
Click to expand...
Click to collapse
But, you deodexed them to edit the smali files in the classes.dex right? So, no, you will need to use the new odex files that are created from the modded deodexed files you used..
If you never edited any of the smali files, then you didn't need to deodex in the first place... you only need to deodex in order to mod the smali files - everything else in the apk can be modded as is on odexed systems.
Sent from my phone's mind
Thank you very much. Can you repost the wrapper file? Its not downloading correctly.
Didact74 said:
Thank you very much. Can you repost the wrapper file? Its not downloading correctly.
Click to expand...
Click to collapse
Updated the link in Post #2 with a zip file - you need to unzip it first then move it.
Thank you.
So I am getting an error trying to re-odex. See the attached image of the error.
Weird thing is that even though I get an error it still creates the new.odex file. I triedto go through the entire process even though I was getting errors and it just got stuck on the boot screen and never loaded. Anything in my error attached raise any flags?
Thanks,
Didact74 said:
Thank you.
So I am getting an error trying to re-odex. See the attached image of the error.
Weird thing is that even though I get an error it still creates the new.odex file. I triedto go through the entire process even though I was getting errors and it just got stuck on the boot screen and never loaded. Anything in my error attached raise any flags?
Thanks,
Click to expand...
Click to collapse
Hmmm... First thing I can think of is: are all of those framework files in the bootclass path that you used actually in your /framework folder? With our A2, in ICS there are a few extra .jar files listed that were not actually on our phone, so I had to remove those from the path...
I will try to make a new odex myself and make sure that's not a standard error message... @Fall of Enosis, you recall what it spits out?
EDIT: Shoot - forgot I'm deodexed right now... will attempt later or hear back from Fall by then..
alteredlikeness said:
Hmmm... First thing I can think of is: are all of those framework files in the bootclass path that you used actually in your /framework folder? With our A2, in ICS there are a few extra .jar files listed that were not actually on our phone, so I had to remove those from the path...
I will try to make a new odex myself and make sure that's not a standard error message... @Fall of Enosis, you recall what it spits out?
EDIT: Shoot - forgot I'm deodexed right now... will attempt later or hear back from Fall by then..
Click to expand...
Click to collapse
Yes, all .jar files listed in my bootclass were located in the framework directory.
Nevermind...my mistake. I had an issue with my files not being deodexed correctly from the start. I went back and deodexed, made the edits to res and smali then odexed using the method above again and all went well!
Thanks!

[HowTo] Odex FRAMEWORK, all Android versions may apply.

Here in this tutorial, I will show some facts about Deodex and Odex, then explain how to odex the framework of a ROM(which is pretty annoying, you'll find out). Credits goes to myself
This method should work on all Android devices.
------------------------------------------------------------------------------------------------------------
First of all, what is odex? Something you should know about classes.dex.
Odex stands for Optimized dex. I'm not gonna explain a lot because I'm not sure if I'm right. First of all, in typical apk files, when you open it with WinRAR or something like that, you can find a file called "classes.dex"(this type of apk is deodexed). This file is the key. It contains the core codes of the apk. However the other type of apk comes with an *.odex file and doesn't have classes.dex inside the apk file. This is odexed apk. There are 2 types of ROMs here, odexed and deodexed. Odexed ROMs' classes.dex are already out of the apk files, while deodexed ROMs' classes.dex are still in the apks. When Android executes an apk, it has to extract the classes.dex out and execute it. So when you flash an deodexed ROM, the first boot takes a long long time since the Android system needs to extract all the classes.dex into dalvik-cache(it shows "Optimizing apks" on the screen for 4.0 ROMs, shows boot animation on screen for 2.3 or below ROMs). However for the odexed ROMs, because the classes.dex are already out there, the system just grabs them and use them, without wasting time and storage space extracting classes.dex out.
Why odex framework?
It can boost your device a little by odexing your framework. Your phone can run more efficiently. Although it's a complicated process, but trust me, it's worth it.
What is so special about odexing framework files? What's the difference?
Odexing an app is very easy, and I believe everyone knows how to do it. But odexing framework is really annoying. Why? Because apps and more like stand-alone things, they are not a part of system. You delete it, nothing bad happens, your phone still boots, you just get endless FC if you delete the wrong one, or missing status bar, that's all. But framework files you cannot mess around. They are parts of the system. They have to match the system's codes precisely, without any error, even the order of files(keep this in mind, very important). So for every ROM, the framework initialize codes are different(same RUU or other ROM based ROMs count as its base ROM), and you must modify the odexing binary to make it odex for you properly, or you can sit and watch the beautiful bootloop.
What's the relationship between odexing apps and odexing framework?
Simple, but important. If you odexed apps, you cannot touch the framework. Framework always goes in the first place. If you wanna odex both, you must odex framework first. Or... "The Tragedy of App and Framework"...
So what do we have to keep in mind before we start?
Keep your mind clear, prepare a bag of ice in case you feel dizzy with the codes, and MAKE ENOUGH SPACE FOR FRAMEWORK ODEXING. I would prefer you remove a few useless apks in /system/app first to make more room in system partition. Failing odexing may brick your device forever! Nah just kidding it will only cause you to bootloop. No big deal. Also, it won't odex your framework-res.apk and always will not, so don't feel bad and do it again and again till your phone burn . Make sure your device is ROOTED and enable USB debug. You need Java Runtime Environment.
What tools do you need?
Notepad++ and a magical rar that contains all you need to success.
Let's get started.
------------------------------------------------------------------------------------------------------------
1. Use your file manager to find init.rc at the very root directory of your phone and copy it to SDCard for later code editing, or you simply adb pull it out and skip the coping step. (If you know how to compile boot.img it is even easier, just unpack boot in Android Kitchen, look for line "export BOOTClassPATH". I'm not gonna introduce that method since most people can't. Silly me, didn't I just intoduced that? XD)
2. Connect USB, set mode as disk drive so you can access your SDCard. Copy init.rc into your computer. Open it with notepad, and find where it says "export BOOTClassPATH", create a new file and copy line "export BOOTClassPATH" into the new file. For example:
Code:
export BOOTCLASSPATH/system/framework/core.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar:/system/framework/core-junit.jar:/system/framework/HTCExtension.jar:/system/framework/com.htc.framework.jar:/system/framework/com.htc.android.pimlib.jar:/system/framework/com.htc.android.easopen.jar:/system/framework/com.scalado.util.ScaladoUtil.jar:/system/framework/com.orange.authentication.simcard.jar:/system/framework/android.supl.jar:/system/framework/com.ecrio.sip.jar
3. Open dexopter in the rar you downloaded with Notepad++. Find the lines that show the similar contents to the things after "export BOOTClassPATH". It is Line 21 to Line 35 on my laptop. Edit them according to the things you just copied out of init.rc. For example, if the first file is "X.jar", then you will have to edit the line into "dexopt-wrapper/system/framework/X.jar /system/framework/X.odex". Then repeat until you finish with all the files that are listed in the long list you copied out of init.rc. File order DOES MATTER. Use the bag of ice I told you to prepare eariler to make you sober if you feel dizzy with the codes. The lines may be more or less after you edited them, doesn't matter.
4. Copy "dexopter" and "dexopt-wrapper" into /system/bin and set the correct permissions. Make sure they have enough permission to change your system files. Restart your phone.
5. Go to CMD and lead it to where adb.exe is(included in the rar). Type these in order:
Code:
adb shell
su
cd system/framework
dexopter fr
Then the codes will run crazy in your cmd window... The odex process has begun!
6. If the odex process completed without error, you are half way there! Well it doesn't mean you have to stare at your screen during the process. It's about time we figure it out! The phone will automatically reboot once it's finished. If it doesn't and you are sure all are done, reboot manually.
7. If you can't boot properly, go back and check everything carefully. If you can, then open your file manager and copy the entire framework directory into your SDCard. You can still adb pull and skip the next coping step.
8. Mount SDCard. Go into framework directory on your computer. Open every file that has an odex file with it, delete the classes.dex inside. WinRAR is okay. The files may seem ridiculously small after you delete the classes.dex, but don't worry since classes.dex are already pulled out and turned into odex files.
9. Copy the whole framework folder into the folder where adb is at. Use adb to push all the files back into /system/framework.
Code:
adb root
adb remount
adb push framework /system/framework
adb shell
su
chmod /system/framework xxx (xxx is a permission code, depends on your ROM. They should be the same as the old deodexed framework files. Use Google to find out how to use the permission codes.)
10. After all the files are pushed in, reboot your phone.
11. If it still boots into the system, congratulations! You've successfully odexed your framework! If it doesn't, then go back and read everything carefully. The most common error occurs when you are editing the dexopter code. You will have to redo everything again.
Done! Everything is ready to go!
You can directly grab the files you've odexed and put it in your custom ROM(must be the same base), just don't forget the odex files.
------------------------------------------------------------------------------------------------------------
Okay, hmm, what to say now? Still, I would be glad if you donated me, but if you don't it's okay, just reply and hit thanks .
Oh almost forgot, the magical rar: http://d-h.st/tYi
------------------------------------------------------------------------------------------------------------
Big thanks to Scott, see him in #3. He explained why some files aren't odexed and provided a easier method(but they all get you dizzy )
Big thanks to JSLEnterprises, see him in #4. He provided a newer busybox for Scott's method.
If you can, send me a PM on how to odex apps.
Sent from my HTC One X using Tapatalk 2
BreatheHT said:
Here in this tutorial, I will show some facts about Deodex and Odex, then explain how to odex the framework of a ROM(which is pretty annoying, you'll find out). Credits goes to myself
Also, it won't odex your framework-res.apk and always will not, so don't feel bad and do it again and again till your phone burn . Make sure your device is ROOTED and enable USB debug. You need Java Runtime Environment.
Click to expand...
Click to collapse
Good write up. Other files that wont "re-odex" are com.htc.resources.apk, com.htc.videowidget.res.apk, com.htc.weather.res.apk and framework-htc-res.apk.
The reason? The files dont have .dex files because there is no code in them. These files just carrier resources like images (for those that didint know).
The .dex files are the actual smali code that devs mod to make the ROM do crazy things
Also, an easier method can be found here: http://themikmik.com/showthread.php?12988-Tool-App-Dexo-the-Universal-Odex-Utility
It does it all and pulls the bootclass for you. And it also does /system/app/ in one simple shot.
Also, one last thing... You can just as easily pull the files back to the PC using the ADB Pull command...
Code:
adb pull /system/app ./app
adb pull /system/framework/ ./framework
EDIT: And another simple method to get your bootclass is do another ADB Pull
Code:
add pull init.rc
I find the adb pull method quicker and more simple...
theking_13 said:
If you can, send me a PM on how to odex apps.
Sent from my HTC One X using Tapatalk 2
Click to expand...
Click to collapse
You can use the method I just explained or if you want to try the framework manually then do apps seperately then you can use this: http://forum.xda-developers.com/showthread.php?t=1514576
I use that app to re-odex updated files in the ROM. For example... If Gmail updates (which it just did) I would remove the old gmail files from system/app/ and put the new one in and run that program then pull the files.
-Scott
If anyone finds this to be too much work... dont worry... it only unpacks the classes.dex once. It will only need to unpack a dex if original file has changed (changed entries need to propogate). That's why all the consecutive boots are back to a 'normal' span of time.
re-odexing your roms IS recommended if either A) you're anal-retentive/have OCD or B) propogation ("Android is Upgrading...") happens every time you reboot your device (it happens sometimes)
If you're going to use the tool scrosler linked to, replace the busybox binary with the one inside the attatched zip (this is busybox 1.20.1). The one that come with the tool is pretty dated.
:good:
Update: Busybox 1.20.2 has been released (though not compiled for android use yet)
Great stuff guys.
scrosler said:
Good write up. Other files that wont "re-odex" are com.htc.resources.apk, com.htc.videowidget.res.apk, com.htc.weather.res.apk and framework-htc-res.apk.
The reason? The files dont have .dex files because there is no code in them. These files just carrier resources like images (for those that didint know).
The .dex files are the actual smali code that devs mod to make the ROM do crazy things
Also, an easier method can be found here: http://themikmik.com/showthread.php?12988-Tool-App-Dexo-the-Universal-Odex-Utility
It does it all and pulls the bootclass for you. And it also does /system/app/ in one simple shot.
Also, one last thing... You can just as easily pull the files back to the PC using the ADB Pull command...
Code:
adb pull /system/app ./app
adb pull /system/framework/ ./framework
EDIT: And another simple method to get your bootclass is do another ADB Pull
Code:
add pull init.rc
I find the adb pull method quicker and more simple...
You can use the method I just explained or if you want to try the framework manually then do apps seperately then you can use this: http://forum.xda-developers.com/showthread.php?t=1514576
I use that app to re-odex updated files in the ROM. For example... If Gmail updates (which it just did) I would remove the old gmail files from system/app/ and put the new one in and run that program then pull the files.
-Scott
Click to expand...
Click to collapse
hehe yep I know the adb pull command, I thought about it and I didn't put it in...
theking_13 said:
If you can, send me a PM on how to odex apps.
Sent from my HTC One X using Tapatalk 2
Click to expand...
Click to collapse
You confused bro?
Thanks. Even though I won't ever be doing this, it's good to know what's going on.
This is awesome. Thanks so much for this. I wanted to know how to odex and deodex roms.
Sent from my HTC One XL using xda app-developers app
scrosler said:
Good write up. Other files that wont "re-odex" are com.htc.resources.apk, com.htc.videowidget.res.apk, com.htc.weather.res.apk and framework-htc-res.apk.
The reason? The files dont have .dex files because there is no code in them. These files just carrier resources like images (for those that didint know).
The .dex files are the actual smali code that devs mod to make the ROM do crazy things
Also, an easier method can be found here: http://themikmik.com/showthread.php?12988-Tool-App-Dexo-the-Universal-Odex-Utility
It does it all and pulls the bootclass for you. And it also does /system/app/ in one simple shot.
Also, one last thing... You can just as easily pull the files back to the PC using the ADB Pull command...
Code:
adb pull /system/app ./app
adb pull /system/framework/ ./framework
EDIT: And another simple method to get your bootclass is do another ADB Pull
Code:
add pull init.rc
I find the adb pull method quicker and more simple...
You can use the method I just explained or if you want to try the framework manually then do apps seperately then you can use this: http://forum.xda-developers.com/showthread.php?t=1514576
I use that app to re-odex updated files in the ROM. For example... If Gmail updates (which it just did) I would remove the old gmail files from system/app/ and put the new one in and run that program then pull the files.
-Scott
Click to expand...
Click to collapse
Is there also a tool to deodex roms?
Sent from my HTC One XL using xda app-developers app
SkizzMcNizz said:
Is there also a tool to deodex roms?
Sent from my HTC One XL using xda app-developers app
Click to expand...
Click to collapse
Like Scott posted?
Basically that is the steps right there..you are doing the apk in the system/app and framework.
That link provides a tool which when done properly will run on the de-odexed stock Rom and odex it...
Good luck with that...it's a nightmare...haha..
SkizzMcNizz said:
Is there also a tool to deodex roms?
Sent from my HTC One XL using xda app-developers app
Click to expand...
Click to collapse
Yep Android Kitchen can do it.
Hopefully this will help to see more odex ROMs
This is the first phone I've had where developers strive to odex their roms
Something to get used to
Sent from my HTC One X using Tapatalk 2
superchilpil said:
This is the first phone I've had where developers strive to odex their roms
Something to get used to
Sent from my HTC One X using Tapatalk 2
Click to expand...
Click to collapse
Most official ROMs are odexed.
BreatheHT said:
Most official ROMs are odexed.
Click to expand...
Click to collapse
Quite the opposite where I come from
Although I came from a different carrier so this side of the forums is different
Sent from my HTC One X using Tapatalk 2
superchilpil said:
Quite the opposite where I come from
Although I came from a different carrier so this side of the forums is different
Sent from my HTC One X using Tapatalk 2
Click to expand...
Click to collapse
Nah carrier doesn't matter.
SkizzMcNizz said:
Is there also a tool to deodex roms?
Sent from my HTC One XL using xda app-developers app
Click to expand...
Click to collapse
http://forum.xda-developers.com/showthread.php?t=1208320
(you'll have to update the versions included in the zip as this thread is dated - 2011)
Note: the API level for 4.0.3/4.0.4 (what our HOX's run) is '15'.
you can also use DSIXDA's kitchen which can be used to batch deodex apk's after you set the api level
(it's defaulted to '10'... which was Gingerbread -> 2.3.3-2.3.7)
Full list of API levels for their specific Android versions
BreatheHT said:
hehe yep I know the adb pull command, I thought about it and I didn't put it in...
Click to expand...
Click to collapse
Yeah, I like to do it better that way. Dont have to move my hands from the keyboard and mouse. Makes you more efficient :good:
BreatheHT said:
Most official ROMs are odexed.
Click to expand...
Click to collapse
I think all?
superchilpil said:
Quite the opposite where I come from
Although I came from a different carrier so this side of the forums is different
Sent from my HTC One X using Tapatalk 2
Click to expand...
Click to collapse
Carrier is irrelevant. Most people dont know how to work with ODEX files so they go with de-odex. Its mroe challanging but provides a better experience.
techlogik said:
Like Scott posted?
Basically that is the steps right there..you are doing the apk in the system/app and framework.
That link provides a tool which when done properly will run on the de-odexed stock Rom and odex it...
Good luck with that...it's a nightmare...haha..
Click to expand...
Click to collapse
No he is asking to go the other way from odex to de-odex.
BreatheHT said:
Yep Android Kitchen can do it.
Click to expand...
Click to collapse
JSLEnterprises said:
http://forum.xda-developers.com/showthread.php?t=1208320
(you'll have to update the versions included in the zip as this thread is dated - 2011)
Note: the API level for 4.0.3/4.0.4 (what our HOX's run) is '15'.
you can also use DSIXDA's kitchen which can be used to batch deodex apk's after you set the api level
(it's defaulted to '10'... which was Gingerbread -> 2.3.3-2.3.7)
Full list of API levels for their specific Android versions
Click to expand...
Click to collapse
Click to expand...
Click to collapse
Yep, I love that script. I was the one that sent him the mnt point file for the HOX :highfive:
I am going to talk to him about bringing in "official" support for the Asus TF300T. I got the boot.img fiugred out this morning! Woot. **** is about to get real with the Asus!
superchilpil said:
This is the first phone I've had where developers strive to odex their roms
Something to get used to
Sent from my HTC One X using Tapatalk 2
Click to expand...
Click to collapse
its a good final touch when cook done with smali tweaks.
another benefit is sorta kang-protection

Categories

Resources