yashsingh1/xdaforums huggingface dataset:
[G1 Android Development] Speeddymon:
So I decided to check out moto's site for their source code. They apparently didnt modify anything, and just link you to the android git.

I already had that and had it compiled. So I thought for a minute and checked, and sure enough there is a core.jar unodexed in there, in the out/target/product/generic/system/framework directory. So I extracted it, deleted the classes.dex, extracted the Droid core.jar and diffed the 2.

1 change, the build number of the java used.... no biggie, just means I used a later version of java when I built the source.

So then I ran the Droid core.odex through deodexerant and the source classes.dex through baksmali and recursively diffed the out dirs from those. Quite a few changes, all one liners, but I figured "wth" and tossed the source core.jar on the phone with the rest of my already deodexed apks and jars, rebooted, and I'll be damed, but it actually worked!

I've posted the diff along with a nandroid of the unodexed system dir over on alldroid in the Droid dev forum (cant provide the link due to being a newly registered user) in case anyone wants to have a look. Maybe jubeh can see which line in the diff is causing the core to fail to boot when deodexed.
[G1 Android Development] Markley02:
download no longer works.

Edit: Nevermind, its working
[G1 Android Development] j_r0dd:
any chance on updating to use baksmali v1.2 released today?
[G1 Android Development] Daneshm90:
Hmm im REALLY BUSY with midterms n stuff :(

His new smali/baksmali incorporates deodexerant...so thts AWESOME

Expect in 1-3 days :)
[G1 Android Development] j_r0dd:
thanks! yeah that is nice add.
[G1 Android Development] enomther:
Got your PM, I'll get back to you as soon as possible on it ... is this for KB7's cliq mod?

Vurry nice work man ... can't say it enough :D

~enom~
[G1 Android Development] j_r0dd:
yup for kb7's. thanks!
[G1 Android Development] crzyruski:
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
[G1 Android Development] j_r0dd:
thank you sir! 2 questions. does this require the main framework files to be de-odexed first? should i just put these framework files in the same directory as the .bats & baksmali/smali?

i keep getting errors stating something like "core.jar does not contain classes.dex"
[G1 Android Development] Daneshm90:
Awesome man. Got JesusFreke's email yesterday n started some work. But meh i like urs :D
[G1 Android Development] crzyruski:
For best results: copy all files from /system/framework to the framework folder in Deo_1.2

Files should go into the folders, not where the .bats are.

"app" folder for apks

"framework" folder for non-odexed framework

"deodexed_JAR" folder for odexed framework (if you already have it)

Hope this helps
[G1 Android Development] crzyruski:
Thanks :)

I included a zipalign call after deodexed APK is created. Any reason to not do this? I don't think your original script had a call to it, but the zipalign exec was there.
[G1 Android Development] j_r0dd:
that's what i did but i kept getting that error i posted. i will try again in a few.
[G1 Android Development] Daneshm90:
Well zipalign causes certain apk's to cause problems such as settings.apk. Just add an exception to that script for tht apk n theres some others i forget.

I just deodexed all of amonra's odexed rom including frameworks...they all deodexed w/o errors. Are u sure ur putting in framework folder and executing deoall.bat ?
[G1 Android Development] j_r0dd:
Error occured while loading boot class path files. Aborting.

org.jf.dexlib.Util.ExceptionWithContext: zip file core.jar does not contain a cl

asses.dex file

at org.jf.dexlib.Util.ExceptionWithContext.withContext(ExceptionWithCont

ext.java:58)

at org.jf.dexlib.Code.Analysis.ClassPath.loadBootClassPath(ClassPath.jav

a:114)

at org.jf.dexlib.Code.Analysis.ClassPath.initClassPath(ClassPath.java:64

)

at org.jf.dexlib.Code.Analysis.ClassPath.InitializeClassPath(ClassPath.j

ava:54)

at org.jf.baksmali.baksmali.disassembleDexFile(baksmali.java:68)

at org.jf.baksmali.main.main(main.java:263)

Caused by: java.lang.RuntimeException: zip file core.jar does not contain a clas

ses.dex file

at org.jf.dexlib.DexFile.<init>(DexFile.java:308)

at org.jf.dexlib.Code.Analysis.ClassPath.loadBootClassPath(ClassPath.jav

a:112)

... 4 more

Error while reading boot class path entry "core.jar".

UNEXPECTED TOP-LEVEL EXCEPTION:

java.lang.RuntimeException: Cannot find file or directory "out"

at org.jf.smali.main.main(main.java:161)
[G1 Android Development] j_r0dd:
100% positive.
[G1 Android Development] Daneshm90:
Right this error occurs if im not wrong when ur deodexing apk's with dependencies on the bootpath. But if the jar's of the bootpath are odexed they'll b missing the classes.dex from them. hence u gotta deodex ur frameworks before u start deodexing ur apps.
[G1 Android Development] j_r0dd:
just attempted that lol

Error occured while loading boot class path files. Aborting.
org.jf.dexlib.Code.Analysis.ValidationException: class Landroid/content/DialogIn
terface$OnCancelListener; cannot be resolved.
at org.jf.dexlib.Code.Analysis.ClassPath$UnresolvedClassDef.unresolvedVa
lidationException(ClassPath.java:391)
at org.jf.dexlib.Code.Analysis.ClassPath$UnresolvedClassDef.getSuperclas
s(ClassPath.java:395)
at org.jf.dexlib.Code.Analysis.ClassPath$ClassDef.loadAllImplementedInte
rfaces(ClassPath.java:676)
at org.jf.dexlib.Code.Analysis.ClassPath$ClassDef.<init>(ClassPath.java:
532)
at org.jf.dexlib.Code.Analysis.ClassPath.loadDexFile(ClassPath.java:127)

at org.jf.dexlib.Code.Analysis.ClassPath.loadBootClassPath(ClassPath.jav
a:118)
at org.jf.dexlib.Code.Analysis.ClassPath.initClassPath(ClassPath.java:64
)
at org.jf.dexlib.Code.Analysis.ClassPath.InitializeClassPath(ClassPath.j
ava:54)
at org.jf.baksmali.baksmali.disassembleDexFile(baksmali.java:68)
at org.jf.baksmali.main.main(main.java:263)

UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.RuntimeException: Cannot find file or directory "out"
at org.jf.smali.main.main(main.java:161)

here is a link to the files i am trying to de-odex

http://www.mediafire.com/?wzmnzzzmfmm
[G1 Android Development] Daneshm90:
K do u have the init.rc file for this rom ur trying to deodex ? can u tell me wht the bootclasspath is ?
[G1 Android Development] j_r0dd:
BOOTCLASSPATH is

/system/framework/core.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar
[G1 Android Development] crzyruski:
Wait for JF's bug fix :)
[G1 Android Development] Daneshm90:
I dunno if its a bug cuz i deodexed amonra's full odexed build n it deodexed fine didnt test it but i got no errors n jar's with classes.dex in the end. His are something different. Dunno :(
[G1 Android Development] j_r0dd:
i am waiting for a bug fix. motoblur has just been a pain in the ars period.
[G1 Android Development] crzyruski:
http://code.google.com/p/smali/issues/detail?id=16 its a bug - I got this error code with JR33's files
[G1 Android Development] TheMarkness:
JF got a beta put together that apparently takes care of the issue but it's just given me a new issue trying to deodex the phone.odex and telephonyprovider.odex out of the eris 2.1 system.img

Error occured while loading boot class path files. Aborting.
org.jf.dexlib.Util.ExceptionWithContext: Could not find class Lcom/htc/preferenc
e/HtcListPreference;
at org.jf.dexlib.Code.Analysis.ClassPath.loadClassDef(ClassPath.java:183
)
at org.jf.dexlib.Code.Analysis.ClassPath.access$700(ClassPath.java:42)
at org.jf.dexlib.Code.Analysis.ClassPath$ClassDef.loadSuperclass(ClassPa
th.java:689)
at org.jf.dexlib.Code.Analysis.ClassPath$ClassDef.<init>(ClassPath.java:
575)
at org.jf.dexlib.Code.Analysis.ClassPath.loadClassDef(ClassPath.java:187
)
at org.jf.dexlib.Code.Analysis.ClassPath.initClassPath(ClassPath.java:80
)
at org.jf.dexlib.Code.Analysis.ClassPath.InitializeClassPath(ClassPath.j
ava:58)
at org.jf.baksmali.baksmali.disassembleDexFile(baksmali.java:71)
at org.jf.baksmali.main.main(main.java:268)
Error while loading class Lcom/android/phone/CLIRListPreference; from file Phone
.odex

Hope that helps you guys, if you have any idea if I might be missing something please feel free to let me know ;)
[G1 Android Development] TheMarkness:
Nevermind did not realize how many extra BOOTCLASSPATH's an htc rom has that you have to define (above the standard 5 jars). Beta attached works perfect and got the job done for me guys hope it helps! :)
[G1 Android Development] j_r0dd:
now it is working beautifully!!
[G1 Android Development] crzyruski:
I have two Android Settings APKs for my DSTL1 ROM:

Both called DualSimSettings.apk (and respective odex). One is from an official build and one from an unofficial build.

The only known difference between the two builds is locales.

Neither produce errors when deodexed, but the unofficial one FCs and doesn't even render a proper icon.

I have tried this with and without zipalign... any thoughts??
[G1 Android Development] crzyruski:
Auto-Deodexer [SCRIPT] for baksmali/smali v1.2.1

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

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

Preface:

You must have a copy of your framework folder. (baksmali v1.2.x 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 take no responsibility, check my work to be sure :) 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 05/04/2010

Changed for v1.2.1 & minor tweaks 05/06/2010
[G1 Android Development] j_r0dd:
i have 2 apps that i can't de-odex! all the frameworks and other apps de-odex just fine for me. it won't boot until i get the blur-services.apk de-odexed. moto is a pain
[G1 Android Development] domenukk:
Trying out now..

got a few issues, though... :/ probably because I am trying on Droid eris...

more than just the normal

...

still trying.
[G1 Android Development] Daneshm90:
Are you using jf's newest smali/baksmali ? it autodetects the bootclasspath. Try with out putting the bootpath.
[G1 Android Development] j_r0dd:
ok i got them all deodexed thanks to 1.22.
[G1 Android Development] j_r0dd:
since the eris is running sense you need to add the following.

-c :com.htc.framework.jar
[G1 Android Development] Daneshm90:
Awesome work.
[G1 Android Development] domenukk:
Tried it, but no success. some of the apps still give errors...

Here is how I deodex the framework: (based on crzyruski's script)

:: deodex
@echo Deodexing JAR...
java -Xmx512m -jar baksmali-1.2.2.jar -c :com.htc.framework.jar -d framework -d deodexed_JAR -x "%~dp0framework\%~n1.odex"
java -jar smali-1.2.2.jar out -o "%~dp0temp_%~n1\classes.dex"
7za a -tzip %~dp0deodexed_JAR\%~n1.jar "%~dp0temp_%~n1\*" -mx5

and the apk...

:: deodex
@echo Deodexing APK...
java -Xmx512m -jar baksmali-1.2.2.jar -c :com.htc.framework.jar -d deodexed_JAR -d framework -x "%~dp0app\%~n1.odex"
java -jar smali-1.2.2.jar out -o "%~dp0temp_%~n1\classes.dex"
7za a -tzip %~dp0deodexed_APK\%~n1._apk "%~dp0temp_%~n1\*" -mx5

...

I don't even know what the error is because cmd only stores like 100 lines or so... :mad:

But may try it again to find out...
[G1 Android Development] j_r0dd:
do you have a link to the rom? that is what i used to deodex the Incredible dump. but i didn't deodex those files with that script. the ones that gave me errors i manually did.
[G1 Android Development] domenukk:
It's the king eris rom. any help is very apprechiated :)
[G1 Android Development] j_r0dd:
send me a link if you want help. i am not gonna go searching around for the rom sorry.
[G1 Android Development] Serris:
I get the following error when de-odexing app's:

zipaling.exe

The program can't start because mgwz.dll is missing from your computer. try reinstalling the program to fix this problem.

I get this every new app is being processed.

plus no apps show in the deodexed_APK

only thing seem to be deodexed are .jar's

oh im trying to deodex Smoki 0.3 rom
[G1 Android Development] Daneshm90:
Wierd, is the file present in the directory ?
[G1 Android Development] Serris:
nope, but i downloaded it and it worked, but still framework wasnt sucessfully deodexed, got plenty java class errors when jar's were deodexing, and htc resources & framework-res also werent deodexed they remained in framework directory

but i still gave it a try didn't even boot :)

Is it just me that hates odex so much?
[G1 Android Development] Daneshm90:
Em for htc frameworks you have to include a specific bootclass path, i think i posted in the OP if not check a couple of posts before your's. Its bootclasspath is different than stock android's.
[G1 Android Development] j_r0dd:
anybody good with bash scripts? i just made the switch to Mint from Windows and I am having some difficulties converting these.
[G1 Android Development] j_r0dd:
you need to add the following to the bootclass path if you are trying to deodex an htc rom with sense.

-c :com.htc.framework.jar
[G1 Android Development] Serris:
um where excatly do i have to put this, where is bootclass? :)
[G1 Android Development] j_r0dd:
DeoAPK.bat

java -Xmx512m -jar baksmali-1.2.2.jar -c :com.htc.framework.jar -d framework -d deodexed_JAR -x "%~dp0app\%~n1.odex"

DeoJAR.bat

java -Xmx512m -jar baksmali-1.2.2.jar -c :com.htc.framework.jar -d framework -d deodexed_JAR -x "%~dp0framework\%~n1.odex"
[G1 Android Development] Serris:
I moded like you said but it is still a no go, thanks anyway
[G1 Android Development] Serris:
okay I found out that deodexed APK's don't have classes.dex inside, but jar's have them, so don't know what is wrong, maybe this has got something with missing mgwz.dll

EDIT: if i use 1.2.2 version no apk's have classes.dex, if I use the version(that still needs usb link with phone) some apk's have classes.dex, really wierd
[G1 Android Development] j_r0dd:
most apk's do have a classes.dex. there must be another bootclass that is needed for the rom you are trying to deodex. basically if it has a corresponding odex file if this process is succesful then you will see the generated classes.dex in jar or apk
[G1 Android Development] Serris:
Yes that I know but how do I know wich bootclass do I need or is missing?
[G1 Android Development] Daneshm90:
I think its in init.rc. Theres a line that defines the bootclasspath.
[G1 Android Development] tjohnsonjr:
I did this and I still can't get this ROM to boot. Everything seems to deodex fine. Any ideas on what I may be missing. I trying to deodex an Eris Rom
[G1 Android Development] Daneshm90:
So all your jar's and apk's have a classes.dex inside them ? Furthermore, you have to look more closely at the bootclasspath, they're maybe paths you forgot to include. Try the init.rc file in your root folder. Additionally, also make sure you deodexed the ENTIRE rom, not just framework, that was one of the points JF mentioned.
[G1 Android Development] tjohnsonjr:
I wasn't deodexing the entire ROM. I do that along with double checking the apk's.
[G1 Android Development] Daneshm90:
Ok so if you are trying to deodex a couple of apk's and try in another rom then its different, but if you are trying to deodex a rom to make it boot on your phone well then you have to deodex your entire rom.
[G1 Android Development] tjohnsonjr:
Yeah I'm trying to deodex an entire ROM so I customize it.
[G1 Android Development] Daneshm90:
Right so first deodex the frameworks using the proper bootclasspath, then use the frameworks as a base as you are deodexing your /system/app/ apk's and any other apks you have left. Then once you have no more odex left, then try to boot into the rom.
[G1 Android Development] j_r0dd:
Re: Auto-Deodexer [SCRIPT] [Devs Only]

after trying to deodex a sense rom again last night. You will need to add more bootclass paths. I will look again tonight and post what else you need to add. I will try to edit the scripts and upload a version for sense roms only. I cant promise anything since I am not that good at scripting. I deodexed the ones that failed with the script, manually one at a time. Just an fyi when it fails, most if the time it is pretty clear what bootclass you are missing from the error it spits out.
[G1 Android Development] Daneshm90:
Good idea, if you have ne problems let me know, i was thinkin of adding an option where u choose 1 for sense roms, 2 for non sense roms, that kinda thing.
[G1 Android Development] domenukk:
That would be great ;)

or how about simply chekcing if sense framework is in the framework folder...
[G1 Android Development] Daneshm90:
Even better :)
[G1 Android Development] j_r0dd:
If you can do that go for it because my scripting skills are extremely limited lol. I can at least give you the bootclass paths needed :)
[G1 Android Development] Daneshm90:
Em sure just gimme those n ill spit out a new batch file :)
[G1 Android Development] j_r0dd:
-c:com.htc.android.easopen.jar:com.htc.android.pimlib.jar:com.htc.framework.jar:com.scalado.util.ScaladoUtil.jar
[G1 Android Development] Daneshm90:
Ok ive updated with a new menu added. Let me know how it goes.
[G1 Android Development] j_r0dd:
thanks! ok i made a gramatical edit to the seojar.bat and updated this for smali/baksmali v1.2.2. since 1.2.2 has a huge speed improvement. here is the issue that happens with the script (sense)...as soon as it gets to the core.jar it spits out an error stating it can't find core.odex and then the remaning spit out the same error.

http://bit.ly/9zDSHT
[G1 Android Development] Daneshm90:
Thnx man, yup updated the first posts's link.
[G1 Android Development] j_r0dd:
just need to find out whats going on deodexing the sense roms. something with the script and added bootclass paths. once it starts core.jar its like it forgets where its located
[G1 Android Development] Daneshm90:
Can you send me a odexed sense ui dump or something to try it out on ? thnx
[G1 Android Development] j_r0dd:
check the link in about 10 minutes and it should be good.

http://bit.ly/9blopx
[G1 Android Development] Daneshm90:
K thnx. Will take a look.
[G1 Android Development] Pyr0x64:
sorry for the noobish questions...

but are there still problems with sense and can i use this to deodex an r2 mcr rom?
[G1 Android Development] Daneshm90:
Hey, wht is r2 mcr rom ? Anyway, for the sense deodexing option, we're having some trouble when it comes to core.jar. So it will deodex a majority of the files fine, but a few you might have to manually odex.
[G1 Android Development] Serris:
Lol I'm still missing mgwz.dll, does any one else have this problem?

PS: what is manual deodex? I mean how can I do it? thanks :)
[G1 Android Development] Daneshm90:
You'll have to look at JF's site for instructions, just google it :) i dunno why ur having this dll issue, it CLEARLY is there.
[G1 Android Development] Serris:
I arleady downloaded it, I'm just curious if someone else has the problemo
[G1 Android Development] Daneshm90:
I doubt it, ppl have pm'd me saying it works fine.
[G1 Android Development] Serris:
So I tried to deodex a sense rom with the new auto-deodexer. Still a no go 3/4 of apps dont have classes.dex :(
[G1 Android Development] Daneshm90:
Is ur framework de-odexed ? check if all your framework jar/apk's have a classes.dex in them, especially core.jar.
[G1 Android Development] Serris:
Core, ext, framework, framework-tests, ime, input, monkey, pm, services, svc don't have classes.dex
[G1 Android Development] Daneshm90:
Theres your problem, this script is not stable yet for sense roms, you'll have to manually deodex the framework's it doesnt do automatically. It doesnt like core.jar for some reason, it gets there and gives up. But ppl have told me tht manually deodexing those missing frameworks worked fine.
[G1 Android Development] Serris:
Thanks for the fast responses, I'll have to do some research in for the manual deodexing
[G1 Android Development] tjohnsonjr:
I am trying to deodex an Sense Rom but I don't want to use Sense with the ROM. Should I delete all the apk's associated with Sense and then try to run script with the remaining files?
[G1 Android Development] j_r0dd:
i deodexed the incredible dump with no issues. i just ran the script without adding any special bootclass paths. sit there with a pen and paper and wrote down every .apk & .jar that spit out errors. then go back and manually deodex them.

http://code.google.com/p/smali/wiki/DeodexInstructions
[G1 Android Development] j_r0dd:
i would deodex the whole thing before you start removing apk's or jar's
[G1 Android Development] Serris:
This link shows manual deodexing, but how can I start baksmali or smali. I'm using Windows 7 x64?
[G1 Android Development] chocmatic:
If I'm not mistaken its java -jar baksmali-1.2.X.jar or you can try it without the java -jar. I'm still trying to get the new sprint leak rom deoxedized.
[G1 Android Development] Serris:
I have to rename the baksmali to java -jar baksmali-1.2.2?
[G1 Android Development] chocmatic:
if you're using the baksmali file then just add the .jar...it looks like it wants the whole file name to be able to work in winmo7
[G1 Android Development] xaueious:
The tools work fine in x64 Win7
[G1 Android Development] chocmatic:
Has anyone been able to deoxedize a sense rom?
[G1 Android Development] Serris:
Looks like im a total noob, I can't start baksmali :(
[G1 Android Development] Daneshm90:
Quick Update : This script will not work on froyo roms. JesusFreke has to wait for the 2.2 source code to drop before he can modify his smali/baksmali to take account those changes. If you try to do it, itll give u a "magic error".