babyrjw / smali

Automatically exported from code.google.com/p/smali
0 stars 0 forks source link

baksmali not working after following directions #203

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I built smali as the the section BuildProcedure indicates. Then I copied all 
the files in the folder /smali/baksmali/build/libs in /usr/local/bin/ and in 
the Desktop, where I have the files framework.odex and core.odex. 
I got the odex files from an Samsung Galaxy Player with Android 2.3.3 API 10, 
using "adb pull ...".

When I run the command: "baksmali -10 -x framework.odex" I got the following 
error:
baksmali: command not found

Then I tried by running "java -jar baksmali.jar -x framework.odex" and "java 
-jar baksmali-2.0.3-2d8cbfe6.jar -x framework.odex", and the following error 
appears for both of them:
Error occurred while loading boot class path files. Aborting.
org.jf.util.ExceptionWithContext: Cannot locate boot class path file 
/system/framework/core.odex
    at org.jf.dexlib2.analysis.ClassPath.loadClassPathEntry(ClassPath.java:217)
    at org.jf.dexlib2.analysis.ClassPath.fromClassPath(ClassPath.java:161)
    at org.jf.baksmali.baksmali.disassembleDexFile(baksmali.java:68)
    at org.jf.baksmali.main.main(main.java:279)

Also I tried by running: "java -jar baksmali.jar -c :core.ode -x 
framework.odex", but the exactly same error occurs.

What am I doing wrong? 

Appreciate any help you could provide.

gus. 

Original issue reported on code.google.com by pelao.mu...@gmail.com on 19 Feb 2014 at 11:32

GoogleCodeExporter commented 9 years ago
With respect to the "baksmali: command not found", the baksmali wrapper script 
only works for a unix-like environment. The correct way to run it on windows is 
the java -jar approach.

You're not using the correct command line argument for deodexing. In 
particular, for baksmali 2.0, you should pretty much never have to use -c. 
Also, "-10" is non-sensical. You specify the api level using the -a option. 
Finally, you need to specify the directory containing the framework files using 
the -d option.

This is all described at 
https://code.google.com/p/smali/wiki/DeodexInstructions.

Original comment by jesusfreke@jesusfreke.com on 20 Feb 2014 at 12:31

GoogleCodeExporter commented 9 years ago
Thanks for answering again.
I am running the baksmali command in Ubuntu 12.04.
Now I run the command: "baksmali -a 10 -x framework.odex -d framework", and the 
error says:
"baksmali: command not found".
and the same error occurs for "baksmali -a 10 -x framework.odex"

What I do not understand is the directory from where to get the dependencies, 
which is specified by the option -d. How should I get the dependencies for 
framework.odex?
I downloaded the framework using "adb pull /system/framework/framework.odex"

Also, did I make any mistake by copying the files from 
/smali/baksmali/build/libs to /usr/local/bin/ and to the folder where the odex 
files are? The files I copied were:
baksmali.jar
baksmali-2.0.3-2d8cbfe6.jar
baksmali-2.0.3-2d8cbfe6-javadoc.jar
baksmali-2.0.3-2d8cbfe6-sources.jar
maven-2.0.3-dev.jar

Again thanks for any help you could provide.

Original comment by pelao.mu...@gmail.com on 20 Feb 2014 at 5:11

GoogleCodeExporter commented 9 years ago
Ah, sorry. I'm not sure why I had thought you were on a windows system, you 
clearly stated unix paths in the original report. In any case, the baksmali 
wrapper is just a normal shell script. It just needs to be executable, have a 
baksmali.jar in the same directory as it.

Regarding the dependencies, just pull everything from /system/framework to a 
directory somewhere and pass that directory using the -d option.

You only need to copy the baksmali wrapper script (in the top level scripts 
directory) and the baksmali.jar from the build directory (which is actually a 
symlink to the most recently built jar).

Original comment by jesusfreke@jesusfreke.com on 20 Feb 2014 at 7:06

GoogleCodeExporter commented 9 years ago
I copied the script "baksmali" from "smali/scripts/" in ~/Desktop, and also I 
copied the file "baksmali.jar" from smali/baksmali/build/libs/ in ~/Desktop.
Then I got all the files from /system/framework/ into the folder 
~/Desktop/androidfiles, using "adb pull /system/framework/".
Then when I run: "baksmali -a 10 -x framework.odex -d androidfiles", the error 
says: "baksmali: command not found".
What am I doing wrong? Am I getting the java script and the jar file from the 
right folders? Do I need to set something in Ubuntu to run Java scripts?
Thanks in advance for any further help. 

Original comment by pelao.mu...@gmail.com on 26 Feb 2014 at 12:50

GoogleCodeExporter commented 9 years ago
"baksmali" is just a normal shell script. Please see 
https://www.google.com/search?q=ubuntu+shell+script+"command+not+found"

Original comment by jesusfreke@jesusfreke.com on 26 Feb 2014 at 2:09

GoogleCodeExporter commented 9 years ago
Thanks! Finally it works.
So, the correct command is: "./baksmali -a 10 -x framework.odex -d 
androidfiles".

Original comment by pelao.mu...@gmail.com on 26 Feb 2014 at 2:59

GoogleCodeExporter commented 9 years ago
i have a problem ... 

Error occurred while loading boot class path files. Aborting.
org.jf.util.ExceptionWithContext: Cannot locate boot class path file 
/system/framework/core.odex
        at org.jf.dexlib2.analysis.ClassPath.loadClassPathEntry(ClassPath.java:217)
        at org.jf.dexlib2.analysis.ClassPath.fromClassPath(ClassPath.java:161)
        at org.jf.baksmali.baksmali.disassembleDexFile(baksmali.java:67)

I use  command 

java -Xmx1024m -jar baksmali.jar -c 
:core.jar:conscrypt.jar:okhttp.jar:core-junit.jar:bouncycastle.jar:ext.jar:com.a
ndroid.nfc.helper.jar:framework.jar:frame
work2.jar:telephony-common.jar:voip-common.jar:mms-common.jar:android.policy.jar
:services.jar:apache-xml.jar:webviewchromium.jar:telephony-msim.jar:org.simallia
nce.openmobileapi.jar:com.android.qcom.nfc_extras.jar:c
om.gsma.services.nfc.jar:qcmediaplayer.jar:WfdCommon.jar:oem-services.jar:qcom.f
mradio.jar:org.codeaurora.Performance.jar:vcard.jar:hwframework.jar:hwcustframew
ork.jar:hwEmui.jar:hwaps.jar::qcrilhook.jar -x framewor
k.odex

Original comment by mabrai...@gmail.com on 16 Mar 2015 at 3:59

GoogleCodeExporter commented 9 years ago
mabrain99 - please read my first comment in this issue.

Original comment by jesusfreke@jesusfreke.com on 16 Mar 2015 at 5:03