Closed GoogleCodeExporter closed 9 years ago
Add all framework files via -c is *never* the correct solution. It can cause
incorrect results in some cases.
It is doubly wrong to add all the framework files via the -c option using an
initial ':' character. Using an initial ':' tells baksmali to append all those
jars to the existing default bootclasspath that it uses (which matches the
BOOTCLASSPATH on most "clean" google android devices). So you will actually end
up with duplicate entries because the default bootclasspath has, for example,
framework.jar, and you are adding an extra framework.jar.
And thirdly, the order of the bootclasspath list does matter. You should have
the files in the same order as in your BOOTCLASSPATH environment variable, with
any extra dependencies at the end.
Now, to address your particular problem, you first need to specify the correct
BOOTCLASSPATH to use via the -c option. Next, assuming that it still can't find
the class, you need to find which jar or apk contains the class that it is
complaining about, and then add it to the end of the classpath that baksmali
searches.
To find which jar/apk the class is in, simply run baksmali without the -x
option on every jar/apk in both /system/framework and /system/app (or on the
associated odex files, as applicable - but still without the -x option). And
then grep through the results for that class.
And finally, if that still doesn't resolve the issue, and you are 100% certain
that the class doesn't exist at all on the device (which does happen on
occasion), then you can use the -I option to ignore these "class not found"
type errors. But if you use the -I option when the class does in fact exist
somewhere on the device, it will likely cause a crash in the application - so
be sure that the class really doesn't exist :)
Original comment by JesusFr...@gmail.com
on 30 Mar 2011 at 6:12
Wow. Thank you for the fast response!!
Thank you for clarifying for me the situation with the bootclasspaths.. Can you
be more specific when you are explaining how to locate with BOOTCLASSPATHS I
will need?
When I run say for example:
java -jar baksmali.jar Settings.apk //I get the following:
UNEXPECTED TOP-LEVEL EXCEPTION:
org.jf.dexlib.DexFile$NoClassesDexException: zip file Settings.apk does not
contain a classes.dex file
at org.jf.dexlib.DexFile.<init>(DexFile.java:305)
at org.jf.baksmali.main.main(main.java:250)
Does that look right? And is that what you want me to do but with all of them,
correct? Definitely don't mind spending serious time on this one.
Original comment by MMWAg...@gmail.com
on 30 Mar 2011 at 6:27
Right. That's because Settings.apk has no classes.dex file. You have to run it
on the odex file, like I mentioned.
Also: you can run baksmali on every apk/jar manually if you want - but I would
suggest some sort of automation - i.e. the gnu find utility, or a quick bash
script or something. ;)
BOOTCLASSPATH is an environment variable on the device:
For example:
jesusfreke@knork:~$ adb shell
# echo $BOOTCLASSPATH
/system/framework/core.jar:/system/framework/bouncycastle.jar:/system/framework/
ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/sy
stem/framework/services.jar:/system/framework/core-junit.jar
#
For that BOOTCLASSPATH, you would use the following option for baksmali:
-c
core.jar:bouncycastle.jar:ext.jar:framework.jar:android.policy.jar:services.jar:
core-junit.jar
Original comment by JesusFr...@gmail.com
on 30 Mar 2011 at 6:43
Great! thank you. It makes a lot more sense now. And yeah. I have a lot of time
but I'm not father time lol I'll try and get a bash script running.
Thanks again for your help! You rock!
Original comment by MMWAg...@gmail.com
on 30 Mar 2011 at 7:02
You are maybe missing some jars, like in the case of the Cliq2 2.3 leak. See
http://modmymobile.com/forums/654-motorola-cliq-2-development/563175-deodexing-t
utorial-3.html#post4103857 for the 2 missing jars :)
Original comment by adum...@gmail.com
on 2 Sep 2011 at 2:07
Original issue reported on code.google.com by
MMWAg...@gmail.com
on 30 Mar 2011 at 5:42