[UTIL][22/2/13]Auto Odexer Script V2.1-Mod your odex files with a breeze

alkhafaf

Senior Member
Apr 7, 2012
1,082
637
0
NEW VERSION 2.1, it is now much easier and like a breeze...


Before u read, u should know that this thread is for themers and modders only... and this is not a tool for odexing the whole ROM.


Hello everybody
While I was working on my ROM, and releasing an odex version, I suffered alot in working on the odex files and modifying them. Every time I should use the command line and copy certain commands from a notepad, in addition I have to edit the notepad file to make the commands odex other files... that was a pain... :(

ok.. the odex commands that were used are taken from this thread by sicopat, big thanks to his efforts. Actually I was thinking in how to make it easier for me to odex these modified files, so I tried to make a script that easily odex files, put the files in the right folder, run the script, and then write the name of the file u want to odex, then..... Waw the file is odexed in the phone and ready to run :) :)

For anyone that want to use these scripts, I wanted to share it with you, and I hope they would be useful to you.

Update (2/22/13) v2.1:
1. bootclasspath should be put manually from now, because $BOOTCLASSPATH doesn't work when no root in recovery.
2. Fixed a mistake in extracting and archiving files, now it's ok.
3. Now you can restore the original files if you like after odexing.
4. 7zip 32 bit is used instead of 64 bit, sorry for this, now it should work with 32 bit windows too.
5. Script re-arranged, and 7zip log operations saved in 7z_log.txt. you can check this one if you suspect in 7zip operation.
6. Backup of the original files before odexing and restore them after odexing.

Update (1/4/13) v2: All things automated, no need to edit the script for bootclasspath, and even no need to drag and drop the edited files from the modded apk or jar.

Update (9/20/12) v1.4: remount using busybox, this solves some remounting problems.

update (9/18/12) v1.3: adb added to the program, to make it work independently. And now you can pull the files after odexing if u need that.

update (9/10/12) v1.2: updated and added a missed command, it should works perfect. No need to put any files in your sdcard to make the operations... and the operations are commented so you can diagnose the problem if occurred.

download from here


Before you use, make sure u r running the corresponding odex rom in your device, then read how to use this tool.

How to use:
first extract the downloaded file to a folder then:
1. Put your bootclasspath in bootclasspath.txt (follow the instruction below in Important Note 2).
2. Put the original odex and apk (or jar) file in the "original" folder.
3. Put your modded deodexed apk (or jar) file in the "mod" folder
4. Connect your phone with usb and make sure adb is working. ( and don't forget to check the USB Debugging in the settings of your device).
5. It is better that you boot in recovery mod, specially when odexing framework files.
6. Now run the script (.bat file), choose the one for apk or for the jar, according to file you want to odex.
7. after the script opens, write the name of the apk (or jar) file without the .apk (or .jar)
8. Odexing......done.
9. after finishing odexing, u can pull the odexed apk or jar file by pressing 1 then Enter, the it will be pulled in the (pulled_files) folder. Or if you want to restore the original apk (or jar) file with its odex, then press 2.

If you find this thread useful, pressing the thanks button is appreciated.


Important note: If you r using a rooted stock kernel, then u could face problem in remounting, hence a problem in the script. To solve this problem check this post.

Important note 2:To get Your BOOTCLASSPATH:
1. In adb:
adb devices
adb remount
adb shell echo $BOOTCLASSPATH

after that, you can right click and choose (mark), then mark the bootclasspath then press (enter) now you have copied the bootclasspath. go to bootclasspath.txt in the extracted folder of the script, then paste the bootclasspath and save the file.


OR

2. In the root of your device, in the init.rc file:

look for a line with (bootclasspath= ), then copy everything on the right hand of the equal mark. Go to bootclasspath.txt then paste it there, then save the file.

screenshot:




Credit:
Sicopat- for his guide on odexing.
M_j_Nazari- for his guide on odexing and his written commands for the odexing operation. thread link
 
Last edited:

davidwilson83

Retired Forum Moderator / Inactive Recognized Them
Apr 20, 2012
4,150
12,707
263
37
Perth
I keep getting this error when trying to use your script. Help please?

Code:
remounting
'adb' is not recognized as an internal or external command,
operable program or batch file.
 
  • Like
Reactions: Saleen NS

alkhafaf

Senior Member
Apr 7, 2012
1,082
637
0
I keep getting this error when trying to use your script. Help please?

Code:
remounting
'adb' is not recognized as an internal or external command,
operable program or batch file.
This happened cuz u didn't add the adb directory to the system variables...
Anyway I updated it and it should work now without doing that...please try it and give me a feedback.. :)
 

davidwilson83

Retired Forum Moderator / Inactive Recognized Them
Apr 20, 2012
4,150
12,707
263
37
Perth
This happened cuz u didn't add the adb directory to the system variables...
Anyway I updated it and it should work now without doing that...please try it and give me a feedback.. :)
Ok mate. I'll download it and try it when I get home. Just for future reference though, how do I add the ADB directory to system variables??
 
  • Like
Reactions: Saleen NS

alkhafaf

Senior Member
Apr 7, 2012
1,082
637
0
Ok mate. I'll download it and try it when I get home. Just for future reference though, how do I add the ADB directory to system variables??
Go to my computer,then properties, in advanced there is Environment Variables, press it .. then in system variables add the (path) and write the directory that leads to the adb that u have when u installed android development tools ( it should be in platform-tools folder).

Try odexer first before doing that ;) I can not try it cuz I don't know who to delete the adb from the system variables :p

Sent from tapatalk using sgs i9000

[ROM][GB][JW8] MesoROM v2.0 8/27/2012 Ultra Light-Smooth-Beauty

Google+
 
Last edited:

davidwilson83

Retired Forum Moderator / Inactive Recognized Them
Apr 20, 2012
4,150
12,707
263
37
Perth
Go to my computer,then properties, in advanced there is Environment Variables, press it .. then in system variables add the (path) and write the directory that leads to the adb that u have when u installed android development tools ( it should be in platform-tools folder).

Try odexer first before doing that ;) I can not try it cuz I don't know who to delete the adb from the system variables :p

Sent from tapatalk using sgs i9000

[ROM][GB][JW8] MesoROM v2.0 8/27/2012 Ultra Light-Smooth-Beauty

Google+
Will do when I get home from work mate. So in about 6 hours. But who's counting? :p
 

davidwilson83

Retired Forum Moderator / Inactive Recognized Them
Apr 20, 2012
4,150
12,707
263
37
Perth
Lol.. of course not.. cuz I will sleep now... its 6 am here :p and didn't sleep yet... and you r living the new day :p


Sent from tapatalk using sgs i9000

[ROM][GB][JW8] MesoROM v2.0 8/27/2012 Ultra Light-Smooth-Beauty

Google+
Ok I tried it and it didn't work properly.

Code:
remounting
adb server is out of date.  killing...
* daemon started successfully *
List of devices attached
0019295d0b1c9e  device

remount failed: Operation not permitted

Enter the name of the .apk file u want to odex (without .apk): Mms

sending dexopt-wrapper to the device
failed to copy 'dexopt-wrapper' to '/system/bin/dexopt-wrapper': Read-only file
system
Unable to chmod /system/bin/dexopt-wrapper: Read-only file system

sending the deodexed file to the device
failed to copy 'mod\Mms.apk' to '/system/app/Mms.apk': Read-only file system

Odexing the file:
Unable to create '/system/app/new_Mms.odex': Read-only file system

No error found

pushing the original files to the system
failed to copy 'original\Mms.apk' to '/system/app/Mms.apk': Read-only file syste
m
failed to copy 'original\Mms.odex' to '/system/app/Mms.odex': Read-only file sys
tem

Setting permissions..
Unable to chmod /system/app/Mms.odex: Read-only file system
Unable to chmod /system/app/Mms.apk: Read-only file system
Unable to chmod /system/app/new_Mms.odex: No such file or directory

copying signature from original file:
/system/bin/sh: busybox: cannot execute - Permission denied

replacing with the new odex file
/system/bin/sh: cp: not found

settings permissions for the new odex file
Unable to chmod /system/app/Mms.odex: Read-only file system
Unable to chmod /system/app/Mms.odex: Read-only file system

deleting worked- on file
rm failed for /system/app/new_Mms.odex, No such file or directory

Finished

To odex a file again, press any key
To pull the apk file, press 1
To exit, press 0
That's the error I keep getting. What does it mean? Am I doing something wrong?
 

blahbl4hblah

Inactive Recognized Developer
Oct 3, 2010
6,061
1,514
0
Los Angeles, CA
Ok I tried it and it didn't work properly.

Code:
remounting
adb server is out of date.  killing...
* daemon started successfully *
List of devices attached
0019295d0b1c9e  device

remount failed: Operation not permitted

Enter the name of the .apk file u want to odex (without .apk): Mms

sending dexopt-wrapper to the device
failed to copy 'dexopt-wrapper' to '/system/bin/dexopt-wrapper': Read-only file
system
Unable to chmod /system/bin/dexopt-wrapper: Read-only file system

sending the deodexed file to the device
failed to copy 'mod\Mms.apk' to '/system/app/Mms.apk': Read-only file system

Odexing the file:
Unable to create '/system/app/new_Mms.odex': Read-only file system

No error found

pushing the original files to the system
failed to copy 'original\Mms.apk' to '/system/app/Mms.apk': Read-only file syste
m
failed to copy 'original\Mms.odex' to '/system/app/Mms.odex': Read-only file sys
tem

Setting permissions..
Unable to chmod /system/app/Mms.odex: Read-only file system
Unable to chmod /system/app/Mms.apk: Read-only file system
Unable to chmod /system/app/new_Mms.odex: No such file or directory

copying signature from original file:
/system/bin/sh: busybox: cannot execute - Permission denied

replacing with the new odex file
/system/bin/sh: cp: not found

settings permissions for the new odex file
Unable to chmod /system/app/Mms.odex: Read-only file system
Unable to chmod /system/app/Mms.odex: Read-only file system

deleting worked- on file
rm failed for /system/app/new_Mms.odex, No such file or directory

Finished

To odex a file again, press any key
To pull the apk file, press 1
To exit, press 0
That's the error I keep getting. What does it mean? Am I doing something wrong?
That's because your system isn't being set to read write. And it looks like your using an old adb

Sent from my Sensation
 

davidwilson83

Retired Forum Moderator / Inactive Recognized Them
Apr 20, 2012
4,150
12,707
263
37
Perth
That's because your system isn't being set to read write. And it looks like your using an old adb

Sent from my Sensation
Ok then. Is there a way of setting my file system to read write? And do I just need to update the SDK via Eclipse to get a newer version of adb??
 

davidwilson83

Retired Forum Moderator / Inactive Recognized Them
Apr 20, 2012
4,150
12,707
263
37
Perth
Did u boot into recovery while doing this operation ?


Sent from tapatalk using sgs i9000

[ROM][GB][JW8] MesoROM v2.0 8/27/2012 Ultra Light-Smooth-Beauty

Google+
No I didn't. Do I just need to be on the main screen of ClockWorkMod recovery? And do I put it into recovery before I plug it into the USB cable or half way through the process?
 

alkhafaf

Senior Member
Apr 7, 2012
1,082
637
0
You don't need to go into recovery to do this.
Just make the script to mount system as a rw.



Sent from my Sensation
But the script already include that (adb remount)

I think the problem is in the adb itself.. I put the adb with two files with it related to it for the script to use... r these the only files related to adb? Cuz I can not test it as i can not delete the adb from the system variables.

Sent from tapatalk using sgs i9000

[ROM][GB][JW8] MesoROM v2.0 8/27/2012 Ultra Light-Smooth-Beauty

Google+
 
Last edited:
  • Like
Reactions: davidwilson83

blahbl4hblah

Inactive Recognized Developer
Oct 3, 2010
6,061
1,514
0
Los Angeles, CA
But the script already include that (adb remount)

I think the problem is in the adb itself.. I put the adb with two files with it related to it for the script to use... r these the only files related to adb? Cuz I can not test it as i can not delete the adb from the system variables.

Sent from tapatalk using sgs i9000

[ROM][GB][JW8] MesoROM v2.0 8/27/2012 Ultra Light-Smooth-Beauty

Google+
Well my advice is to test this completely before releasing an update
 

alkhafaf

Senior Member
Apr 7, 2012
1,082
637
0
Well my advice is to test this completely before releasing an update
It should work for anyone who added the adb path to the system variables...I really tested it and works fine.

The only thing that I didn't test is how the script run independently (using the adb which comes with it without using the adb of the platform-tools by adding its path to the system variables )


Sent from tapatalk using sgs i9000

[ROM][GB][JW8] MesoROM v2.0 8/27/2012 Ultra Light-Smooth-Beauty

Google+
 
  • Like
Reactions: davidwilson83

alkhafaf

Senior Member
Apr 7, 2012
1,082
637
0
No I didn't. Do I just need to be on the main screen of ClockWorkMod recovery? And do I put it into recovery before I plug it into the USB cable or half way through the process?
Bro. Did u add the adb path to the system variables and tried ?

If u want the instructions Google it and u will probably find it.


Sent from tapatalk using sgs i9000

[ROM][GB][JW8] MesoROM v2.0 8/27/2012 Ultra Light-Smooth-Beauty

Google+
 

davidwilson83

Retired Forum Moderator / Inactive Recognized Them
Apr 20, 2012
4,150
12,707
263
37
Perth
Bro. Did u add the adb path to the system variables and tried ?

If u want the instructions Google it and u will probably find it.


Sent from tapatalk using sgs i9000

[ROM][GB][JW8] MesoROM v2.0 8/27/2012 Ultra Light-Smooth-Beauty

Google+
No mate I didn't because you asked me not to so that I could test how it works independently for you. You gave me the instructions in a previous post in this thread.

If that's the only way that I can get it to work (by adding it to the system variables) then I will just have to do that. I don't mind testing it for you, but it's up to you.

Let me know what you would like me to do.
 

alkhafaf

Senior Member
Apr 7, 2012
1,082
637
0
No mate I didn't because you asked me not to so that I could test how it works independently for you. You gave me the instructions in a previous post in this thread.

If that's the only way that I can get it to work (by adding it to the system variables) then I will just have to do that. I don't mind testing it for you, but it's up to you.

Let me know what you would like me to do.
I really appreciate yhat , thanks alot..
But u can try to to add The adb to the system variables, maybe the problem is not with the adb..
If it works for u then please give me a feedback about it


Sent from tapatalk using sgs i9000

[ROM][GB][JW8] MesoROM v2.0 8/27/2012 Ultra Light-Smooth-Beauty

Google+