[Toturial][Windows] How Editing The ODEX framework files? [Simplified]

Search This thread

M_J_Nazari

Inactive Recognized Developer
Jul 14, 2010
1,545
2,578
38
Bushehr
pda-planet.com
Hi, This is a simple tutorial for someone that wants to working on ODEX structure.

All needed files are attached, you don't need to download anything files.
Extract the Amestris_ODEX.zip file, your working folder will be this one.



I'm creating the simple example here.
for example i want to edit the services.jar file on ODEX structure.


We need to work on DEODEX version at first.

You can Deodex your files from here:
The Best solution is here , Android Kitchen by dsixda user.
[KITCHEN] Android Kitchen, v0.192 [Linux / Mac / Windows]
Your Phone needs to be rooted and Busybox get installed.

the sample file is services.jar,also you can do it for any odex file.

1- Do all your editing and working on your deodex version.
2- Create this folders on your sd-card partition.
Code:
amestris_mod
amestris_original
3- Copy your modded file [your deodexed and edited services.jar] into amestris_mod folder.
4- Copy original jar file into amestris_original folder. [original odex services.jar]
5-Copy dexopt-wrapper into /system/bin folder and give full permission to that. [the simple way is root explorer ]

through the adb command:
Run the Amestris.bat file.
Code:
adb remount
adb push dexopt-wrapper /system/bin/dexopt-wrapper
adb shell chown 777 /system/bin/dexopt-wrapper
adb shell chmod 777 /system/bin/dexopt-wrapper

6-run this adb commands.
Code:
adb shell

cp /sdcard/amestris_mod/services.jar /system/framework/services.jar

dexopt-wrapper /system/framework/services.jar /system/framework/new_services.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

cp -f /sdcard/amestris_original/services.jar /system/framework

chmod 777 /system/framework/services.odex
chmod 777 /system/framework/services.jar
chmod 777 /system/framework/new_services.odex

busybox dd if=/system/framework/services.odex of=/system/framework/new_services.odex bs=1 count=20 skip=52 seek=52 conv=notrunc

cp /system/framework/new_services.odex /system/framework/services.odex

chmod 644 /system/framework/services.odex
chown root.root /system/framework/services.odex
rm /system/framework/new_services.odex

reboot

Credits:
M_J_Nazari
sicopat
jubeh
Decad3nce
software_samurai
 

Attachments

  • Amestris_ODEX.zip
    286.1 KB · Views: 2,511
Last edited:

M_J_Nazari

Inactive Recognized Developer
Jul 14, 2010
1,545
2,578
38
Bushehr
pda-planet.com
Android.policy.jar

This is a Sample for android.policy.jar

Run Amestris.bat file and run this commands here
Code:
adb remount
adb shell
cp /sdcard/amestris_mod/android.policy.jar /system/framework/android.policy.jar

dexopt-wrapper /system/framework/android.policy.jar /system/framework/new_android.policy.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

cp -f /sdcard/amestris_original/android.policy.jar /system/framework

chmod 777 /system/framework/android.policy.odex

chmod 777 /system/framework/new_android.policy.odex

busybox dd if=/system/framework/android.policy.odex of=/system/framework/new_android.policy.odex bs=1 count=20 skip=52 seek=52 conv=notrunc

cp /system/framework/new_android.policy.odex /system/framework/android.policy.odex

chmod 777 /system/framework/android.policy.odex
chown root.root /system/framework/android.policy.odex
rm /system/framework/new_android.policy.odex

reboot
 
Last edited:

M_J_Nazari

Inactive Recognized Developer
Jul 14, 2010
1,545
2,578
38
Bushehr
pda-planet.com
This is a Sample for framework.jar

The framework.jar or frameowrk.odex file is very sensitive and vital file for android.
some changes of this file will turn your phone into force close messages.

but i create a sample for this file;

do it like below:
Run Amestris.bat file and type this commands.
Code:
adb remount
adb shell
cp /sdcard/amestris_mod/framework.jar /system/framework/framework.jar
dexopt-wrapper /system/framework/framework.jar /system/framework/new_framework.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
cp -f /sdcard/amestris_original/framework.jar /system/framework
chmod 777 /system/framework/framework.odex
chmod 777 /system/framework/framework.jar
chmod 777 /system/framework/new_framework.odex
busybox dd if=/system/framework/framework.odex of=/system/framework/new_framework.odex bs=1 count=20 skip=52 seek=52 conv=notrunc
cp /system/framework/new_framework.odex /system/framework/framework.odex
chmod 777 /system/framework/framework.odex
chown root.root /system/framework/framework.odex
rm /system/framework/new_framework.odex
reboot
 
Last edited:

chils41

Senior Member
Mar 12, 2009
1,584
299
Thank you so much all you guys.

now lets see if i can use this to port SMemo to imilka's CM9 or AOSP :(

thnx.
 

burakgon

Senior Member
Oct 26, 2010
3,054
3,799
www.burakgon.com
You can do same on linux. Smali is cross platform. Just needs java. I added deoxt wrapper on my ROM's for who want to do it easily.

Sent from my GT-I9000 using Tapatalk 2 Beta-6
 
Last edited:
  • Like
Reactions: M_J_Nazari

myn

Retired Senior Recognized Developer
Nov 15, 2007
2,679
3,985
Great write up.

Does this method also remove the classes.dex file that is found in apks since it is now housed as a seperate .odex file?
 

M_J_Nazari

Inactive Recognized Developer
Jul 14, 2010
1,545
2,578
38
Bushehr
pda-planet.com
Great write up.

Does this method also remove the classes.dex file that is found in apks since it is now housed as a seperate .odex file?

This method doesn't remove anything. this is a method for replacing [editing] odex files.

if you want to convert the apk files to odex structure you need to check the Amestris Odexer Script v1.2.
 

Leechoonhwee

Senior Member
Apr 30, 2006
1,377
221
If my ROM already have framework.odex does it mean that I only need to make the changes directly into the odex file and then recompile it?
 

Top Liked Posts

  • There are no posts matching your filters.
  • 15
    Hi, This is a simple tutorial for someone that wants to working on ODEX structure.

    All needed files are attached, you don't need to download anything files.
    Extract the Amestris_ODEX.zip file, your working folder will be this one.



    I'm creating the simple example here.
    for example i want to edit the services.jar file on ODEX structure.


    We need to work on DEODEX version at first.

    You can Deodex your files from here:
    The Best solution is here , Android Kitchen by dsixda user.
    [KITCHEN] Android Kitchen, v0.192 [Linux / Mac / Windows]
    Your Phone needs to be rooted and Busybox get installed.

    the sample file is services.jar,also you can do it for any odex file.

    1- Do all your editing and working on your deodex version.
    2- Create this folders on your sd-card partition.
    Code:
    amestris_mod
    amestris_original
    3- Copy your modded file [your deodexed and edited services.jar] into amestris_mod folder.
    4- Copy original jar file into amestris_original folder. [original odex services.jar]
    5-Copy dexopt-wrapper into /system/bin folder and give full permission to that. [the simple way is root explorer ]

    through the adb command:
    Run the Amestris.bat file.
    Code:
    adb remount
    adb push dexopt-wrapper /system/bin/dexopt-wrapper
    adb shell chown 777 /system/bin/dexopt-wrapper
    adb shell chmod 777 /system/bin/dexopt-wrapper

    6-run this adb commands.
    Code:
    adb shell
    
    cp /sdcard/amestris_mod/services.jar /system/framework/services.jar
    
    dexopt-wrapper /system/framework/services.jar /system/framework/new_services.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
    
    cp -f /sdcard/amestris_original/services.jar /system/framework
    
    chmod 777 /system/framework/services.odex
    chmod 777 /system/framework/services.jar
    chmod 777 /system/framework/new_services.odex
    
    busybox dd if=/system/framework/services.odex of=/system/framework/new_services.odex bs=1 count=20 skip=52 seek=52 conv=notrunc
    
    cp /system/framework/new_services.odex /system/framework/services.odex
    
    chmod 644 /system/framework/services.odex
    chown root.root /system/framework/services.odex
    rm /system/framework/new_services.odex
    
    reboot

    Credits:
    M_J_Nazari
    sicopat
    jubeh
    Decad3nce
    software_samurai
    4
    Android.policy.jar

    This is a Sample for android.policy.jar

    Run Amestris.bat file and run this commands here
    Code:
    adb remount
    adb shell
    cp /sdcard/amestris_mod/android.policy.jar /system/framework/android.policy.jar
    
    dexopt-wrapper /system/framework/android.policy.jar /system/framework/new_android.policy.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
    
    cp -f /sdcard/amestris_original/android.policy.jar /system/framework
    
    chmod 777 /system/framework/android.policy.odex
    
    chmod 777 /system/framework/new_android.policy.odex
    
    busybox dd if=/system/framework/android.policy.odex of=/system/framework/new_android.policy.odex bs=1 count=20 skip=52 seek=52 conv=notrunc
    
    cp /system/framework/new_android.policy.odex /system/framework/android.policy.odex
    
    chmod 777 /system/framework/android.policy.odex
    chown root.root /system/framework/android.policy.odex
    rm /system/framework/new_android.policy.odex
    
    reboot
    3
    This is a Sample for framework.jar

    The framework.jar or frameowrk.odex file is very sensitive and vital file for android.
    some changes of this file will turn your phone into force close messages.

    but i create a sample for this file;

    do it like below:
    Run Amestris.bat file and type this commands.
    Code:
    adb remount
    adb shell
    cp /sdcard/amestris_mod/framework.jar /system/framework/framework.jar
    dexopt-wrapper /system/framework/framework.jar /system/framework/new_framework.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
    cp -f /sdcard/amestris_original/framework.jar /system/framework
    chmod 777 /system/framework/framework.odex
    chmod 777 /system/framework/framework.jar
    chmod 777 /system/framework/new_framework.odex
    busybox dd if=/system/framework/framework.odex of=/system/framework/new_framework.odex bs=1 count=20 skip=52 seek=52 conv=notrunc
    cp /system/framework/new_framework.odex /system/framework/framework.odex
    chmod 777 /system/framework/framework.odex
    chown root.root /system/framework/framework.odex
    rm /system/framework/new_framework.odex
    reboot
    3
    1: Q: When i use the cp command , the error shows with " cp: not found " message
    A: try to use " busybox cp" instead the " cp " command.
    1
    Excellent explanation!!! Thank you very much.