-----------------------------------------------------------------------------------
With baksmali 2.2.0
java -jar baksmali-2.2.0.jar d boot-telephony-common.odex -o boot-telephony-common
java -jar smali-2.2.0.jar ass boot-telephony-common -o boot-telephony-common.dex
To look at all the classes inside a odex or oat,
java -jar baksmali-2.2.0.jar l classes boot-telephony-common.dex
Updated on March 25th 2016
-----------------------------------------------------------------------------------
Just wanted to make a quick update on this post because this post is outdated.
1. Download latest from https://github.com/JesusFreke/smali/releases
2. Extract and run gradlew.bat or gradlew
3. Files we need will be generated in
smali-2.1.1\baksmali\build\libs
smali-2.1.1\smali\build\libs
4. Copy smali-2.1.1-dev.jar and baksmali-2.1.1-dev.jar to another folder
5. adb pull /system/framework/arm/boot.oat /tmp/framework/boot.oat
6. java -jar baksmali-2.1.1-dev.jar -x -c boot.oat -d /tmp/framework -e /system/framework/framework.jar /tmp/framework/boot.oat -o framework
7.
adb pull /system/app/Stk/oat/arm64/Stk.odex Stk.odex
java -jar baksmali-2.1.1-dev.jar -x -c boot.oat -d /tmp/framework Stk.odex -o Stk
This will make Stk in this current dir.
8. Rebuild Stk
java -jar smali-2.1.1-dev.jar -o whatever.dex Stk
Thats all. Now you should see the whatever.dex in the current dir
-----------------------------------------------------------------------------------
Today, I wanted to decompile Samsung S4 framework2.odex file. As usual, I Googled on how to decompile odex files and nothing really up with step by step on how to decompile a odex file. So i wanted to put it here so it will help someone else one day.
1. Download smali (http://code.google.com/p/smali/)
2. Create baksmali folder and move all these files inside that folder.
baksmali
baksmali-2.0.3.jar
smali-2.0.3.jar
smali-2.0.3.jar
smali-512m
3. Create folder "system" inside "baksmali"
4. Create folder "app" inside "system" folder
Folder structure should look like this.
5. Plug your android device, Open command prompt. Change the directory to "app" folder and type
adb pull /system/app
This pull device's /system/app folder to app folder
6. Now, Create a folder name "framework" inside "system" folder
7. Change command line directory to "framework" folder and type
adb pull /system/framework
This will pull device's /system/framework folder to framework folder.
8. Change the command line to baksmali folder and type.
java -jar baksmali-2.0.3.jar -d system/framework -x framework2.odex
This will create output folder name "out "with smali files in it. Now, We need to create a dex file using smali files inside out folder. To do that
9. java -jar smali-2.0.3.jar -o classes.dex out
will generate classes.dex file.
10. Download dex2jar (http://code.google.com/p/dex2jar/) and decompile the dex file to jar file
11. Use JD-GUI to see the java code (http://java.decompiler.free.fr/?q=jdgui)
Ok, and how to compile sources back to .odex?
ReplyDelete