How to create framework.odex in android

1.9k Views Asked by At

I'm trying to make changes in Android OS so I downloaded AOSP, make some changes and build it.

Now I want to replace framework.jar and framework2.jar on my device (Nexus 5, 4.4.4) but I see that this is an "odex" device - Which means - I have also framework.odex and frameork2.odex.

Can someone help me and explain me how to create those 2 files? I Google it but found only how to odex apk and not framework.

Thank you guys!

2

There are 2 best solutions below

0
On BEST ANSWER

Why don't you try to flash images to device ? You need to build complete AOSP source code and flash device with below commands :

adb reboot bootloader

IMG_PATH="./out/target/product/grouper";

# Erase userdata
fastboot -w

echo Flashing System .. 
fastboot flash system $IMG_PATH/system.img
echo Flashig Boot ... 
fastboot flash boot $IMG_PATH/boot.img
echo Flashin Recovery .. 
fastboot flash recovery $IMG_PATH/recovery.img
echo now rebooting device ...
fastboot reboot

The way you are trying, framework.jar might be having different signature than system signature.

0
On

The relevant documentation is here:

http://androidxref.com/4.4.4_r1/xref/dalvik/docs/dexopt.html

(Don't know how dated this is. You can find hosted versions of this doc by searching for "dexopt.html")

Basically, Android runs dex class files through an optimizer before it runs them. For applications, the optimization happens either at install time, or just-in-time. For framework code, it seems to happen at build time.

Just looking at the information presented there, it seems you can either: