FORUMS
Remove All Ads from XDA

[HOW TO][Windows] Manually Deodex and Odex back

808 posts
Thanks Meter: 963
 
By sicopat, Senior Member on 8th August 2011, 02:08 PM
Post Reply Email Thread
14th August 2011, 09:39 PM |#11  
sicopat's Avatar
OP Senior Member
Thanks Meter: 963
 
Donate to Me
More
Yes you need to use your modded framework.jar in bootclasspath dependencies of dexopt wrapper.

If force close, perhaps you did not erase dalvik cache or made a mistake when modding framework.jar
Did you use the last Smali version out today x.7 to make your mod ? cause smali.jar was buggy with framwork.jar deodexing.

If you just want to odex a theme with more than 1 framework file, you should need to do by step : first you copy 1 file and odex it back then you do the same for second file ... You should only use 1 deodexed jar in your bootclasspath corresponding to the file you try to odex back.

Hope this will help, i cannot help much cause my GS2 doesn't really love the beautifull sand of the mediteraneen sea I am on vacation ...


Sent from my GT-I9100 using XDA Premium App
 
 
15th August 2011, 07:39 AM |#12  
Brotuck's Avatar
Senior Member
Flag Rotterdam
Thanks Meter: 568
 
More
Thanx for the reply, i did just that.

The framework.jar file works flawlessly on a deodexed system, so i guess this file is ok.

But it does not work correctly when trying to odex back. I keep getting (thesame ) errors. Even doing a binary compare of the odex files when trying different methods to odex back is identical.

But the endresult is always thesame. The phone does boot but there are issues inside the jarfile.
20th August 2011, 03:19 PM |#13  
sicopat's Avatar
OP Senior Member
Thanks Meter: 963
 
Donate to Me
More
Quote:
Originally Posted by Brotuck

Thanx for the reply, i did just that.

The framework.jar file works flawlessly on a deodexed system, so i guess this file is ok.

But it does not work correctly when trying to odex back. I keep getting (thesame ) errors. Even doing a binary compare of the odex files when trying different methods to odex back is identical.

But the endresult is always thesame. The phone does boot but there are issues inside the jarfile.

I just remember that original developper of overscroll glow for Galaxy S has stopped to dev odexed owerscroll glow cause of same errors (MMS)
I believe this due to a dexopt wrapper bug on odexing back framework.odex ??
25th August 2011, 12:08 AM |#14  
MCOGW's Avatar
Senior Member
Thanks Meter: 61
 
More
smali / baksmali v1.2.8 is available
25th August 2011, 11:08 PM |#15  
Senior Member
Flag Buckinghamshire
Thanks Meter: 134
 
More
Hi Sicopat,

I'm having issues with this.

I'm currently running XXKG6 ROM that I've successfully deodexed and after reading your thread, I've wrote the below shell script that successfully runs.

Code:
#!/system/bin/sh

chmod 755 /system/bin/dexopt-wrapper
chmod 755 /system/bin/zip

coreframework="/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"

echo "Odexing /system/framework/*jar files"

for i in $coreframework
do	
	filename=$(basename $i .jar)
	dexopt-wrapper $i /system/framework/$filename.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
	zip -d $i classes.dex
done


for i in /system/framework/*.jar
do
	if [ $i == "/system/framework/core.jar" -o $i == "/system/framework/bouncycastle.jar" -o $i == "/system/framework/ext.jar" -o $i == "/system/framework/framework.jar" -o $i == "/system/framework/android.policy.jar" -o $i == "/system/framework/services.jar" -o $i == "/system/framework/core-junit.jar" ]
		then
			echo "Already odexed in sequence"
		else
			filename=$(basename $i .jar)
			dexopt-wrapper $i /system/framework/$filename.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
			zip -d $i classes.dex	
	fi
done

echo "Giving permissions to all *odex files"
chmod -R 777 /sdcard/original-framework/*.odex
chmod -R 777 /system/framework/*.odex

echo "Copying signatures from original odex files"
for i in /sdcard/original-framework/*.odex
do
	filename=$(basename $i .odex)
	busybox dd if=$i of=/system/framework/$filename.odex bs=1 count=20 skip=52 seek=52 conv=notrunc
done

rm -r /data/dalvik-cache/*
The script does the following process:
  1. Sets permisions for the dexopt-wrapper and zip binaries.
  2. Odexes the core framework in the same order they're listed in BOOTCLASSPATH in init.rc.
  3. Odexes the other framework files that were not previously odexed
  4. Copies the signatures from the original XXKG6 .odex files, to the ones that have just been created (the origials are stored on the sdcard)

The only difference in the script I wrote is the classes.dex are removed from the .jar files using the zip binary.

I can see the .odex files created when running a ls /system/framework command and pulling the .jar files reveals that the dex file from inside has been removed.

I've also tried copying the original .jar files over, rather than removing the .dex files on the fly.

However, the phone doesn't even boot, i.e. it doesn't even get past the splash image.

Can you see anything wrong with my logic/shell script?

Many thanks
Mark
28th August 2011, 11:01 AM |#16  
Senior Member
Flag Buckinghamshire
Thanks Meter: 134
 
More
Quote:
Originally Posted by Mekrel

Hi Sicopat,

I'm having issues with this.

I'm currently running XXKG6 ROM that I've successfully deodexed and after reading your thread, I've wrote the below shell script that successfully runs.

Code:
#!/system/bin/sh

chmod 755 /system/bin/dexopt-wrapper
chmod 755 /system/bin/zip

coreframework="/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"

echo "Odexing /system/framework/*jar files"

for i in $coreframework
do	
	filename=$(basename $i .jar)
	dexopt-wrapper $i /system/framework/$filename.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
	zip -d $i classes.dex
done


for i in /system/framework/*.jar
do
	if [ $i == "/system/framework/core.jar" -o $i == "/system/framework/bouncycastle.jar" -o $i == "/system/framework/ext.jar" -o $i == "/system/framework/framework.jar" -o $i == "/system/framework/android.policy.jar" -o $i == "/system/framework/services.jar" -o $i == "/system/framework/core-junit.jar" ]
		then
			echo "Already odexed in sequence"
		else
			filename=$(basename $i .jar)
			dexopt-wrapper $i /system/framework/$filename.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
			zip -d $i classes.dex	
	fi
done

echo "Giving permissions to all *odex files"
chmod -R 777 /sdcard/original-framework/*.odex
chmod -R 777 /system/framework/*.odex

echo "Copying signatures from original odex files"
for i in /sdcard/original-framework/*.odex
do
	filename=$(basename $i .odex)
	busybox dd if=$i of=/system/framework/$filename.odex bs=1 count=20 skip=52 seek=52 conv=notrunc
done

rm -r /data/dalvik-cache/*
The script does the following process:
  1. Sets permisions for the dexopt-wrapper and zip binaries.
  2. Odexes the core framework in the same order they're listed in BOOTCLASSPATH in init.rc.
  3. Odexes the other framework files that were not previously odexed
  4. Copies the signatures from the original XXKG6 .odex files, to the ones that have just been created (the origials are stored on the sdcard)

The only difference in the script I wrote is the classes.dex are removed from the .jar files using the zip binary.

I can see the .odex files created when running a ls /system/framework command and pulling the .jar files reveals that the dex file from inside has been removed.

I've also tried copying the original .jar files over, rather than removing the .dex files on the fly.

However, the phone doesn't even boot, i.e. it doesn't even get past the splash image.

Can you see anything wrong with my logic/shell script?

Many thanks
Mark

Okay, I actually got this to work by removing the copying of signatures from the stock .odex files to the new ones.

I find that a little weird seeing as that step is specifically mentioned in your guide and that the phone is supposedly unable to boot without copying the signature.
4th September 2011, 04:24 PM |#17  
NitroOnTheRocks's Avatar
Senior Member
Thanks Meter: 31
 
More
After deodexing (and not odexing back) my framework and app folder of my custom ROM in my kitchen (before flashing),
is it necessary to sign/resign apks?
7th September 2011, 12:49 AM |#18  
Arhtard's Avatar
Senior Member
Flag Salt Lake City
Thanks Meter: 73
 
More
ok i have a few questions if you wouldnt mind helping.
i've been using androids since July of this year, only 2 months now, so i'm really new to modding...
i'm trying very hard to catch on and to learn...
unfortunately, i purchased a device with absolutely no development

anyway, assuming that you'll help, i'll proceed...

i'm not on a galaxy s II - i'm doing this on a gravity smart.

our bootclass path is different:
system/framework/core.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar
your bootclass path:
/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

so i removed the difference in your command example to this:
java -Xmx1024m -jar baksmali.jar -c :core.jar:framework.jar:android.policy.jar:service s.jar -x android.policy.odex

all is fine, i get an "out" folder created with files in it
i then use your command example:
java -Xmx1024m -jar smali.jar out -o classes.dex
and a classes.dex is created
i then opened the android.policy.jar with 7zip and dropped the classes.dex file in its root
i'm assuming the process is going as its supposed to at this point.

question 1: am i doing this right?

question 2: do i do this to all the .jars in the /system/framework/ directory to have a completely deodexed system (and of course all the /system/app/files)?

question 3: do i also use these methods or the apk methods listed on your 2nd post to do the twframework-res.apk file?

question 4: do i create a new "out" folder for each .jar (run the command line for each .jar) or do i use the first created classes.dex for all the .jar files in /system/framework/ directory?

question 5: after i create the deodexed files i can safely delete the .odex companion files correct? (this may be a dumb question with an obvious answer, but i don't want to screw up)

question 6: can i place the deodexed files on the sdcard and move them with root explorer or do i need to push them thru using ADB?

any help or suggestions would be greatly appreciated!
7th September 2011, 08:11 AM |#19  
sicopat's Avatar
OP Senior Member
Thanks Meter: 963
 
Donate to Me
More
Quote:
Originally Posted by NitroOnTheRocks

After deodexing (and not odexing back) my framework and app folder of my custom ROM in my kitchen (before flashing),
is it necessary to sign/resign apks?

Nope

Sent from my GT-I9100 using xda premium
The Following User Says Thank You to sicopat For This Useful Post: [ View ] Gift sicopat Ad-Free
7th September 2011, 08:32 AM |#20  
sicopat's Avatar
OP Senior Member
Thanks Meter: 963
 
Donate to Me
More
Quote:
Originally Posted by Arhtard

ok i have a few questions if you wouldnt mind helping.
i've been using androids since July of this year, only 2 months now, so i'm really new to modding...
i'm trying very hard to catch on and to learn...
unfortunately, i purchased a device with absolutely no development

anyway, assuming that you'll help, i'll proceed...

i'm not on a galaxy s II - i'm doing this on a gravity smart.

our bootclass path is different:
system/framework/core.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar
your bootclass path:
/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

so i removed the difference in your command example to this:
java -Xmx1024m -jar baksmali.jar -c :core.jar:framework.jar:android.policy.jar:service s.jar -x android.policy.odex

all is fine, i get an "out" folder created with files in it
i then use your command example:
java -Xmx1024m -jar smali.jar out -o classes.dex
and a classes.dex is created
i then opened the android.policy.jar with 7zip and dropped the classes.dex file in its root
i'm assuming the process is going as its supposed to at this point.

question 1: am i doing this right?

question 2: do i do this to all the .jars in the /system/framework/ directory to have a completely deodexed system (and of course all the /system/app/files)?

question 3: do i also use these methods or the apk methods listed on your 2nd post to do the twframework-res.apk file?

question 4: do i create a new "out" folder for each .jar (run the command line for each .jar) or do i use the first created classes.dex for all the .jar files in /system/framework/ directory?

question 5: after i create the deodexed files i can safely delete the .odex companion files correct? (this may be a dumb question with an obvious answer, but i don't want to screw up)

question 6: can i place the deodexed files on the sdcard and move them with root explorer or do i need to push them thru using ADB?

any help or suggestions would be greatly appreciated!

Q1/ yes
Q2/ yes if you want a deodexed Rom
Q3/you don't need to deodex twframework and framework-res ...
Q4/ you need to backsmali every files. You can rename out folders to core, android.policy, ... And replace out with the "name of folder" in smali command. Classes.dex is specific of 1 file

Q5Yes, you can delete odex files. This is the point of deodexing

Q6/ you can do the 2 ways, to try if deodexed files are correct, then correct the permissions and then backup and delete odex file. But for entire rom, the better is to use a non wipe script and to flash the entire deodexed Rom.

Finaly, there are many deodexing auto kit. I made an How to deodex resign and zipalign a customRom, try the kit-Deodexage included.
Or look for more used deodex script cause there are many apks to deodex, doing this manually will be very long ...

Sent from my GT-I9100 using xda premium
The Following 2 Users Say Thank You to sicopat For This Useful Post: [ View ] Gift sicopat Ad-Free
7th September 2011, 08:42 AM |#21  
Arhtard's Avatar
Senior Member
Flag Salt Lake City
Thanks Meter: 73
 
More
Quote:
Originally Posted by sicopat

Q1/ yes
Q2/ yes if you want a deodexed Rom
Q3/you don't need to deodex twframework and framework-res ...
Q4/ you need to backsmali every files. You can rename out folders to core, android.policy, ... And replace out with the "name of folder" in smali command. Classes.dex is specific of 1 file

Q5Yes, you can delete odex files. This is the point of deodexing

Q6/ you can do the 2 ways, to try if deodexed files are correct, then correct the permissions and then backup and delete odex file. But for entire rom, the better is to use a non wipe script and to flash the entire deodexed Rom.

Finaly, there are many deodexing auto kit. I made an How to deodex resign and zipalign a customRom, try the kit-Deodexage included.
Or look for more used deodex script cause there are many apks to deodex, doing this manually will be very long ...

Sent from my GT-I9100 using xda premium

thank you SOOO much!
i appreciate the quick response and courteous answers!
you're awesome!
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes