4

I would like to covert odex file to dex file. I already pulled framework folder from system. I tried the following command,

java -jar baksmali-2.1.2.jar -d system/framework -x temp.odex

but error was produced - error message is like below.

 Error occurred while loading boot class path files. Aborting. org.jf.util.ExceptionWithContext: Cannot locate boot class path file /system/framework/core.jar
        at org.jf.dexlib2.analysis.ClassPath.loadClassPathEntry(ClassPath.java:277)
        at org.jf.dexlib2.analysis.ClassPath.fromClassPath(ClassPath.java:182)
        at org.jf.baksmali.baksmali.disassembleDexFile(baksmali.java:67)
        at org.jf.baksmali.main.run(main.java:113)
        at org.jf.baksmali.main.main(main.java:322)

I could not find "core.jar" in my android system framework folder.

frogatto
  • 28,539
  • 11
  • 83
  • 129
임선빈
  • 61
  • 1
  • 1
  • 5

5 Answers5

5

As of 2017-06-09 baksmali has changed. It works like this.

java -jar baksmali-2.2.0.jar d SamsungInCallUI.odex -o SamsungInCallUI

Then assemble the dex file.

java -jar smali-2.2.0.jar ass SamsungInCallUI -o SamsungInCallUI.dex
kakopappa
  • 5,023
  • 5
  • 54
  • 73
2

Try this instead:

java -jar baksmali-2.1.2.jar -c boot.oat -d system/framework/arm/boot.oat -x temp.odex

The specific path to your boot.oat might be different.

Also note that baksmali doesn't yet support deodexing the N preview images.

JesusFreke
  • 19,784
  • 5
  • 65
  • 68
  • I tried it but another error was produced. Error occurred while loading boot class path files. Aborting. org.jf.util.ExceptionWithContext: Cannot locate boot class path file boot.oat at org.jf.dexlib2.analysis.ClassPath.loadClassPathEntry(ClassPath.java:2 77) at org.jf.dexlib2.analysis.ClassPath.fromClassPath(ClassPath.java:182) at org.jf.baksmali.baksmali.disassembleDexFile(baksmali.java:67) at org.jf.baksmali.main.run(main.java:113) at org.jf.baksmali.main.main(main.java:322) – 임선빈 Apr 29 '16 at 05:53
  • Like I said, the specific path to your boot.oat might be different. – JesusFreke Apr 29 '16 at 07:25
0

This worked for me adb pull /system/framework/arm/boot.oat /tmp/framework/boot.oat Placing the apk and the odex file baksmali.jar -x -c boot.oat -d /tmp/framework APKname.odex -o APKname

ñam
  • 1
  • 1
  • I tried like this. java -jar baksmali-2.1.2.j ar -x -c boot.oat -d system/framework Test.odex -o Test.apk. but error was produced. Error occurred while loading boot class path files. Aborting. org.jf.util.ExceptionWithContext: Cannot locate boot class path file boot.oat at org.jf.dexlib2.analysis.ClassPath.loadClassPathEntry(ClassPath.java:2 77) at org.jf.dexlib2.analysis.ClassPath.fromClassPath(ClassPath.java:182) at org.jf.baksmali.baksmali.disassembleDexFile(baksmali.java:67) at org.jf.baksmali.main.run(main.java:113) at org.jf.baksmali.main.main(main.java:322) – 임선빈 Apr 29 '16 at 06:31
  • 1
    Make sure the file boot.oat is in system/framework this should be the code `java -jar baksmali-2.1.2.jar -x -c boot.oat -d system/framework temp.odex -o temp` – ñam Apr 29 '16 at 07:00
  • I pulled boot.oat from system/framework and retry it. but same error was reproduced. – 임선빈 Apr 29 '16 at 08:01
  • `system/framework` is just the path of boot.oat on your PC, if you just pulled system/framework without moving boot.oat then the path would be `system/framework/arm`, you have to make sure this path leads to boot.oat on YOUR PC. Try this code `java -jar baksmali-2.1.2.jar -x -c boot.oat -d system/framework/arm temp.odex -o temp` – ñam Apr 29 '16 at 19:09
  • Thank you. I successed it for your help. – 임선빈 May 01 '16 at 04:11
0

I'm not sure that I've understood correctly your question (kindly correct me if I'm wrong), but if you are trying to convert an odex to dex, I've already replied to a similar question here: https://reverseengineering.stackexchange.com/questions/12393/reverse-engineering-android-vendor-system-apps/12406#12406

Anyway, to my knowledge you have two chooice:

Good luck

Community
  • 1
  • 1
Luca D'Amico
  • 3,192
  • 2
  • 26
  • 38
  • I tried this with oat2dex. but erro was produced. error message is "OAT Hader Checking..: FAIL! OAT2DEX File Check File FAIL". – 임선빈 May 01 '16 at 00:57
0

This is an extension of @kakopappa's answer.

Get the latest version of baksmali and smali jar from here and put them in a folder and add this method to your .bash_profile file if you are a mac/linux user.

Get baksmali and smali jar in your computer and assign it to these variables from terminal.

BAKSMALI_JAR_PATH = ""

SMALI_JAR_PATH=""

Note : After editing the value should look something like BAKSMALI_JAR_PATH = "/Users/rabbit/tools/baksmali-2.2.7.jar" SMALI_JAR_PATH = "/Users/rabbit/tools/smali-2.2.7.jar"

Copy paste this script in your terminal and restart your terminal. This is a shortcut function which would get added to .bash_profile and you would get it handy.

    echo "BAKSMALI_JAR_PATH="$BAKSMALI_JAR_PATH >> ~/.bash_profile
    echo "SMALI_JAR_PATH="$SMALI_JAR_PATH >> ~/.bash_profile
    echo >>
    function odextodex() {
       odex_file_name=$1
       deassembled_file=${odex_file_name%.odex}
       java -jar $BAKSMALI_JAR_PATH d $1 -o $deassembled_file
       java -jar $SMALI_JAR_PATH ass $deassembled_file -o $deassembled_file.dex
       rm -rf $deassembled_file
    }

After doing this type odextodex filename.odex - you should see filename.jar file in your current directory.

Tom Taylor
  • 3,344
  • 2
  • 38
  • 63