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

Search This thread

Daneshm90

Retired Recognized Developer
Jun 1, 2009
3,332
662
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 :D)
*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

 
Last edited:

enomther

Senior Member
Jun 12, 2009
3,437
146
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~
 

Daneshm90

Retired Recognized Developer
Jun 1, 2009
3,332
662
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~

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
 

enomther

Senior Member
Jun 12, 2009
3,437
146
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

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~
 

Daneshm90

Retired Recognized Developer
Jun 1, 2009
3,332
662
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~

Ah sweet, something i shall incorporate in the script later on. thanx :)
 

Joe333x

Senior Member
Oct 6, 2009
1,070
123
so will this script allow you to take an app from say a cliq dump and allow it to run on any android device?
 

enomther

Senior Member
Jun 12, 2009
3,437
146
Will this allow you to grab the MyFaves from a TMO rom and de-odex it and install?

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~
 

wesgarner

Senior Member
May 10, 2007
825
63
Birmingham, AL
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 :))

So the apk after that has the DEX built in or is dexopt still needed?
 

jubeh

Senior Member
Mar 15, 2009
1,264
20
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]
 
Last edited:

enomther

Senior Member
Jun 12, 2009
3,437
146
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?

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 :D

~enom~
 

jubeh

Senior Member
Mar 15, 2009
1,264
20
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 :D

~enom~

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.
 

Daneshm90

Retired Recognized Developer
Jun 1, 2009
3,332
662
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 ...
 

Daneshm90

Retired Recognized Developer
Jun 1, 2009
3,332
662
Ok so i uploaded with delay between, seems to work fine, tested a LOT of times :)
 

Top Liked Posts

  • There are no posts matching your filters.
  • 11
    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 :D)
    *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

    4
    great job with this script. I use it to deodex some samsung galaxy s and s2 roms.

    i have made one change though. It seems the script is extracting the apk files, and then compressing the whole file again, which results in apk FCs in some ROMs due to resources not being linked correctly.

    To fix this, I've patched your seoAPK and deoAPK bat files to add classes.dex (with compression level 9 by default) to the stock .apk files. This way you keep the best of both worlds, max compression level for the deodexed classes file and the stock compression level for the rest.

    I'm attaching the two files here for those interested,
    3
    Auto-Deodexer [SCRIPT] for baksmali/smali v1.2

    Based on Daneshm90's Auto-Deodexer [SCRIPT] and modified by me (crzyruski) for JF's baksmali / smali v1.2

    I started this for myself, then realized it could be useful for others just as the original was useful to me.
    Feel free to fix.

    Contains:

    • app (directory)
    • deodexed_APK (directory)
    • deodexed_JAR (directory)
    • framework (directory)
    • 7za.exe
    • baksmali-1.2.jar
    • deoall.bat
    • deoAPK.bat
    • deoJAR.bat
    • readme.txt
    • smali-1.2.jar
    • zipalign.exe
    baksmali v1.2 (thanks JF) has a tiny bug with an easy workaround (thanks JF) - this script takes it into account.

    Preface:
    You must have a copy of your framework folder. (baksmali v1.2 requirement)

    You will probably want to have a deodexed framework to meet all the needs of your apk files.

    Instructions:

    If you need to deodex your framework: Place the JARs and corresponding ODEX files in the directory "framework".

    Otherwise: Place your deodexed framework JARs into the directory "deodexed_JAR".

    If you need to optimize (deodex and align) your APKs: Place the APKs and corresponding ODEX files in the directory "app".

    As usual: From command line run "deoall"

    deodexed_JAR = output for deodexed framework (check framework directory for residual files)
    deodexed_APK = output for deodexed APKs

    DISCLAIMER: I have tested the deodexed files on my device aside from the fact that the first boot rebooted on Android load screen, it went fine each time afterward.

    GREETS:
    • JesusFreke
    • Daneshm90

    Change log


    • First post 05/03/2010
    • Added commenting & zipalign 05/03/2010
    • Fixed cleanup problem & made echos shorter
    2
    I know this is an old thread and I didn't really want to resurrect it but I felt the need to post the contents of a VBS script I created to retrieve the names of all JAR files in "framework" and "deodexed_JAR" into the clipboard to easily paste into the custom bootclass field when selecting option "2".

    Place the code into a vbs file (eg. "bootclass.vbs") into the root folder (eg. same folder as "deoall.bat") and double-click it to execute it (or manually run it from command prompt with cscript or wscript) and it will copy it to the clipboard:

    Code:
    Set objFSO   = CreateObject("Scripting.FileSystemObject")
    Set wshShell = CreateObject("WScript.Shell")
    
    SourceFolder = objFSO.GetParentFolderName(WScript.ScriptFullName)
    
    For Each FrameworkFolder In Array("framework","deodexed_JAR")
       FrameWorkFolderPath = SourceFolder & "\" & FrameworkFolder
       If objFSO.FolderExists(FrameWorkFolderPath) Then
          For Each File In objFSO.GetFolder(FrameWorkFolderPath).Files
             FileExtension = objFSO.GetExtensionName(File.Name)
             If uCase(FileExtension) = "JAR" Then
                If Not Contains(BootClass,File.Name) Then
                   If BootClass <> "" Then
                      BootClass = BootClass & ":"
                   End If
                   BootClass = BootClass & File.Name
                End If
             End If
          Next
       Else
          MsgBox "Can't find " & FrameWorkFolderPath
          wscript.quit
       End If
    Next
    
    CopyToClipboard BootClass
    MsgBox "Bootclass copied to clipboard: " & vbCrLf & vbCrLf & BootClass
    
    Function Contains(Text, SearchString)
       Contains = InStr(1,Text,SearchString,vbTextCompare) > 0
    End Function
    
    Sub CopyToClipboard(Text)
       wshShell.Run "cmd /C echo " & Text & "| CLIP", 2
    End Sub
    2
    Hi All,

    Can anyone please refer me to a "Ste by step" for dummies to deodex my 2.3.3 phone?

    Thanks alot

    The secret to make it work is putting whatever deodexer scripting program's folder, after extracting it from the zip, you want to use in the c: drive of your windows computer.

    then put all the apk's with their .odex file from the system/app folder in the app folder
    and the jar's with their .odex file from the framework folder of your system/framework drive on your phone into the framework folder and THEN
    click deoall

    I hope this helps, worked for me. I was rattling my head trying to find out what was wrong forever.

    Now I am having trouble rebooting my phone with the new deodexed files. I am trying to replace them using Root Explorer.
    Should I be replacing the files in the update.zip file and reflashing my stock ROM?