Closed GoogleCodeExporter closed 9 years ago
It sounds likely that your device uses a non-standard set of inline methods.
You'll need to dump the inline methods on your device and pass that list to
baksmali using the -T option.
For more inforamation, see:
https://github.com/JesusFreke/smali/tree/master/deodexerant
I haven't tried this tool in a while, so I'm not sure it still works with
current-ish versions of dalvik. If you have any trouble getting it to run/work,
feel free to let me know on this bug.
Original comment by jesusfreke@jesusfreke.com
on 28 Jan 2014 at 7:05
Yeah I read about deodexerant. I followed your instruction how to build it. But
to be honest I never used Git and the source tree before. Got to the part
building dedexerant, but it fails with error: 'build/core/base_rules.mk:144:
*** smali/deodexerant: MODULE.TARGET.EXECUTABLES.deodexerant already defined by
external/smali/deodexerant. ' and don't really know how to resolv this.
Original comment by marcwa...@gmail.com
on 28 Jan 2014 at 7:36
ah, yeah. I forgot smali was in the AOSP tree. try rm -rf
external/smali/deodexerant
Original comment by jesusfreke@jesusfreke.com
on 28 Jan 2014 at 8:08
That did the trick, building now. Will try dumping the inline methods tomorrow.
Thanks!
Original comment by marcwa...@gmail.com
on 28 Jan 2014 at 8:39
Once you get them, would you mind posting them here? I'm curious what changes
they made :)
Original comment by jesusfreke@jesusfreke.com
on 28 Jan 2014 at 8:55
Sure, no problem.
Original comment by marcwa...@gmail.com
on 28 Jan 2014 at 8:57
Need some help again. After running deodexerant on the device there's only one
line in the output file: 'Failed to load dvmGetInlineOpsTable
'
Any idea's?
Original comment by marcwa...@gmail.com
on 29 Jan 2014 at 7:09
Hmmm, I bet it's because of c++ name mangling. arg.
Looking at my local copy of libdvm, the mangled names are
_Z20dvmGetInlineOpsTablev and _Z26dvmGetInlineOpsTableLengthv.
In deodexerant.c, try replacing "dvmGetInlineOpsTable" with
"_Z20dvmGetInlineOpsTablev" and "dvmGetInlineOpsTableLength" with
"_Z26dvmGetInlineOpsTableLengthv".
If that works for you, I'll update deodexerant to attempt both versions, so it
will work as-is on both older and newer versions of dalvik.
Original comment by jesusfreke@jesusfreke.com
on 29 Jan 2014 at 7:38
Okay, I'll try when I get home from work.
Original comment by marcwa...@gmail.com
on 29 Jan 2014 at 9:03
I think it worked, see the attached file.
Original comment by marcwa...@gmail.com
on 29 Jan 2014 at 8:44
Attachments:
Tried 'java -jar baksmali203.jar -d framework -T inline.txt -x
BatteryWarning.odex' but now I get: 'Exception in thread "main"
java.lang.NullPointerException
at org.jf.dexlib2.analysis.CustomInlineMethodResolver.parseAndResolveInlineMethod(CustomInlineMethodResolver.java:120)
at org.jf.dexlib2.analysis.CustomInlineMethodResolver.<init>(CustomInlineMethodResolver.java:80)
at org.jf.dexlib2.analysis.CustomInlineMethodResolver.<init>(CustomInlineMethodResolver.java:85)
at org.jf.baksmali.main.main(main.java:220)'
Original comment by marcwa...@gmail.com
on 29 Jan 2014 at 8:55
Looks like a bug in baksmali. I'll get a fix out this evening. Sorry about
that! It's obviously not a well-used codepath :)
It looks like they added 3 new inline methods, those last 3. Nothing
particularly interesting though. Thanks!
Original comment by jesusfreke@jesusfreke.com
on 29 Jan 2014 at 9:04
No problem, thanks for the help. I'll wait for your update and try again.
Original comment by marcwa...@gmail.com
on 29 Jan 2014 at 9:07
Ok, I added a fix for the NPE. You can grab the latest source and build it.
Original comment by jesusfreke@jesusfreke.com
on 30 Jan 2014 at 3:40
Working perfect now, thank you!
Original comment by marcwa...@gmail.com
on 30 Jan 2014 at 9:26
[deleted comment]
within the least version of baksmali, I got this exception still today.
---------------------------------------------
$ baksmali -x data@run-test@test-12646@nv008-op-shift.jar@classes.dex -d
framework
Error occurred while disassembling class LBugTrigger_rs; - skipping class
java.lang.RuntimeException: Invalid method index: 30
at org.jf.dexlib2.analysis.InlineMethodResolver$InlineMethodResolver_version36.resolveExecuteInline(InlineMethodResolver.java:175)
at org.jf.dexlib2.analysis.MethodAnalyzer.analyzeExecuteInline(MethodAnalyzer.java:1422)
at org.jf.dexlib2.analysis.MethodAnalyzer.analyzeInstruction(MethodAnalyzer.java:941)
at org.jf.dexlib2.analysis.MethodAnalyzer.analyze(MethodAnalyzer.java:202)
at org.jf.dexlib2.analysis.MethodAnalyzer.<init>(MethodAnalyzer.java:137)
at org.jf.baksmali.Adaptors.MethodDefinition.addAnalyzedInstructionMethodItems(MethodDefinition.java:387)
at org.jf.baksmali.Adaptors.MethodDefinition.getMethodItems(MethodDefinition.java:296)
at org.jf.baksmali.Adaptors.MethodDefinition.writeTo(MethodDefinition.java:198)
at org.jf.baksmali.Adaptors.ClassDefinition.writeVirtualMethods(ClassDefinition.java:322)
at org.jf.baksmali.Adaptors.ClassDefinition.writeTo(ClassDefinition.java:113)
at org.jf.baksmali.baksmali.disassembleClass(baksmali.java:220)
at org.jf.baksmali.baksmali.access$000(baksmali.java:55)
at org.jf.baksmali.baksmali$1.call(baksmali.java:144)
at org.jf.baksmali.baksmali$1.call(baksmali.java:142)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:662)
Original comment by rya...@nvidia.com
on 14 May 2014 at 3:05
Build deodexerant again today in order to deodex my new Jiayu G5S. Got the
'Failed to load dvmGetInlineOpsTable' message again. I saw you edited the code
to to attempt both versions ("_Z20dvmGetInlineOpsTablev" and
"dvmGetInlineOpsTableLength"), but its not working.
Original comment by marcwa...@gmail.com
on 4 Jun 2014 at 5:48
deodexerant is inherently brittle, and is provided on a "best-effort" basis :).
If you want to provide a patch to fix it for your device specifically, I'll be
happy to take a look. You can try looking at the symbols in
/system/lib/libdvm.so and see if maybe the dvmGetInlineOpsTable function is
decorated differently in your copy.
Original comment by jesusfreke@jesusfreke.com
on 4 Jun 2014 at 6:27
I don't have the sources, is there any way to decompile libdvm.so?
Original comment by marcwa...@gmail.com
on 4 Jun 2014 at 6:54
That's my point. Neither do I :)
You can try:
strings libdvm.so | grep dvmGetInlineOpsTable
Original comment by jesusfreke@jesusfreke.com
on 4 Jun 2014 at 7:31
Nevermind, used 'strings' to peek into the libdvm.so. I found
_Z20dvmGetInlineOpsTablev and _Z26dvmGetInlineOpsTableLengthv, so something
else is going wrong. Will have a closer look at it.
Original comment by marcwa...@gmail.com
on 4 Jun 2014 at 7:31
Hello!
I'm getting the 'Exception in thread "main" java.lang.NullPointerException
at org.jf.dexlib2.analysis.CustomInlineMethodResolver.parseAndResolveInlineMethod(CustomInlineMethodResolver.java:120)
at org.jf.dexlib2.analysis.CustomInlineMethodResolver.<init>(CustomInlineMethodResolver.java:80)
at org.jf.dexlib2.analysis.CustomInlineMethodResolver.<init>(CustomInlineMethodResolver.java:85)
at org.jf.baksmali.main.main(main.java:220)'
When I try to use the -T inline.txt on baksmali 2.0.3.
Can anyone point me in the right direction for building latest smali/baksmali?
Oh, and by the way, how do I build deodexerant? I couldn't quite understand how
to...
Sorry to bother you.
Original comment by tifo...@gmail.com
on 30 Nov 2014 at 2:58
See: https://code.google.com/p/smali/wiki/BuildProcedure on how to build
smali/baksmali from source.
The Build instructions for deodexerant are at
https://code.google.com/p/smali/source/browse/deodexerant/README. If you don't
have a clone of the AOSP source, you'll need to follow
https://source.android.com/source/downloading.html first
Original comment by jesusfreke@jesusfreke.com
on 30 Nov 2014 at 3:12
Hello!
Thanks for ansewring...
Unfortunately I'm unable to build:
C:\ANDROID\smali\dexlib2\src\main\java\org\jf\dexlib2\writer\builder\BuilderClas
sDef.java:
86: error: no suitable method found for copyOf(Iterable<CAP#1>)
this.virtualMethods = ImmutableSortedSet.copyOf(Iterables.filter(methods, MethodUt
il.METHOD_IS_VIRTUAL));
^
method ImmutableSet.<E#1>copyOf(E#1[]) is not applicable
(no instance(s) of type variable(s) T exist so that Iterable<T> conforms to E#1[])
method ImmutableSet.<E#2>copyOf(Iterable<? extends E#2>) is not applicable
(cannot infer type-variable(s) E#2,T
(argument mismatch; Iterable<CAP#2> cannot be converted to Iterable<? extends CAP#
2>))
method ImmutableSet.<E#3>copyOf(Iterator<? extends E#3>) is not applicable
(no instance(s) of type variable(s) T exist so that Iterable<T> conforms to Iterator
<? extends E#3>)
method ImmutableSet.<E#4>copyOf(Collection<? extends E#4>) is not applicable
(no instance(s) of type variable(s) T exist so that Iterable<T> conforms to Collecti
on<? extends E#4>)
method ImmutableSortedSetFauxverideShim.<E#5>copyOf(E#5[]) is not applicable
(no instance(s) of type variable(s) T exist so that Iterable<T> conforms to E#5[])
method ImmutableSortedSet.<E#6>copyOf(E#6[]) is not applicable
(no instance(s) of type variable(s) T exist so that Iterable<T> conforms to E#6[])
method ImmutableSortedSet.<E#7>copyOf(Iterable<? extends E#7>) is not applicable
(cannot infer type-variable(s) E#7,T
(argument mismatch; Iterable<CAP#3> cannot be converted to Iterable<? extends CAP#
3>))
method ImmutableSortedSet.<E#8>copyOf(Collection<? extends E#8>) is not applicable
(no instance(s) of type variable(s) T exist so that Iterable<T> conforms to Collecti
on<? extends E#8>)
method ImmutableSortedSet.<E#9>copyOf(Iterator<? extends E#9>) is not applicable
(no instance(s) of type variable(s) T exist so that Iterable<T> conforms to Iterator
<? extends E#9>)
method ImmutableSortedSet.<E#10>copyOf(Comparator<? super E#10>,Iterator<? extends E#1
0>) is not applicable
(cannot infer type-variable(s) E#10
(actual and formal argument lists differ in length))
method ImmutableSortedSet.<E#11>copyOf(Comparator<? super E#11>,Iterable<? extends E#1
1>) is not applicable
(cannot infer type-variable(s) E#11
(actual and formal argument lists differ in length))
method ImmutableSortedSet.<E#12>copyOf(Comparator<? super E#12>,Collection<? extends E
#12>) is not applicable
(cannot infer type-variable(s) E#12
(actual and formal argument lists differ in length))
where E#1,T,E#2,E#3,E#4,E#5,E#6,E#7,E#8,E#9,E#10,E#11,E#12 are type-variables:
E#1 extends Object declared in method <E#1>copyOf(E#1[])
T extends Object declared in method <T>filter(Iterable<T>,Predicate<? super T>)
E#2 extends Object declared in method <E#2>copyOf(Iterable<? extends E#2>)
E#3 extends Object declared in method <E#3>copyOf(Iterator<? extends E#3>)
E#4 extends Object declared in method <E#4>copyOf(Collection<? extends E#4>)
E#5 extends Object declared in method <E#5>copyOf(E#5[])
E#6 extends Comparable<? super E#6> declared in method <E#6>copyOf(E#6[])
E#7 extends Object declared in method <E#7>copyOf(Iterable<? extends E#7>)
E#8 extends Object declared in method <E#8>copyOf(Collection<? extends E#8>)
E#9 extends Object declared in method <E#9>copyOf(Iterator<? extends E#9>)
E#10 extends Object declared in method <E#10>copyOf(Comparator<? super E#10>,Iterator<
? extends E#10>)
E#11 extends Object declared in method <E#11>copyOf(Comparator<? super E#11>,Iterable<
? extends E#11>)
E#12 extends Object declared in method <E#12>copyOf(Comparator<? super E#12>,Collectio
n<? extends E#12>)
where CAP#1,CAP#2,CAP#3 are fresh type-variables:
CAP#1 extends BuilderMethod from capture of ? extends BuilderMethod
CAP#2 extends BuilderMethod from capture of ? extends BuilderMethod
CAP#3 extends BuilderMethod from capture of ? extends BuilderMethod
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
4 errors
:dexlib2:compileJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':dexlib2:compileJava'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to
get more log output.
BUILD FAILED
Total time: 51.391 secs
Original comment by tifo...@gmail.com
on 30 Nov 2014 at 2:10
Hmm. Try adding "sourceCompatibility = 1.6" (without the quotes) to the top
level build.gradle, in the "subprojects" block, just above the line with
"version = parent.version".
If that works, let me know and I'll make that change
Original comment by jesusfreke@jesusfreke.com
on 30 Nov 2014 at 4:40
Added:
subprojects {
apply plugin: 'java'
apply plugin: 'idea'
sourceCompatibility = 1.6
version = parent.version
Build result:
(...lots of similiar lines before just like the next lines...)
C:\ANDROID\smali\util\src\main\java\org\jf\util\SparseIntArray.java:84:
warning: no @param for key
public int getClosestSmaller(int key) {
^
C:\ANDROID\smali\util\src\main\java\org\jf\util\SparseIntArray.java:84:
warning: no @return
public int getClosestSmaller(int key) {
^
C:\ANDROID\smali\util\src\main\java\org\jf\util\SparseIntArray.java:101:
warning: no @param for key
public void delete(int key) {
^
C:\ANDROID\smali\util\src\main\java\org\jf\util\SparseIntArray.java:112:
warning: no @param for index
public void removeAt(int index) {
^
C:\ANDROID\smali\util\src\main\java\org\jf\util\SparseIntArray.java:123:
warning: no @param for key
public void put(int key, int value) {
^
C:\ANDROID\smali\util\src\main\java\org\jf\util\SparseIntArray.java:123:
warning: no @param for value
public void put(int key, int value) {
^
C:\ANDROID\smali\util\src\main\java\org\jf\util\SparseIntArray.java:161:
warning: no @return
5 errors
public int size() {
54 warnings
^
C:\ANDROID\smali\util\src\main\java\org\jf\util\SparseIntArray.java:170:
warning: no @param for index
public int keyAt(int index) {
^
C:\ANDROID\smali\util\src\main\java\org\jf\util\SparseIntArray.java:170:
warning: no @return
public int keyAt(int index) {
^
C:\ANDROID\smali\util\src\main\java\org\jf\util\SparseIntArray.java:179:
warning: no @param for index
public int valueAt(int index) {
^
C:\ANDROID\smali\util\src\main\java\org\jf\util\SparseIntArray.java:179:
warning: no @return
public int valueAt(int index) {
^
C:\ANDROID\smali\util\src\main\java\org\jf\util\SparseIntArray.java:188:
warning: no @param for key
public int indexOfKey(int key) {
^
C:\ANDROID\smali\util\src\main\java\org\jf\util\SparseIntArray.java:188:
warning: no @return
public int indexOfKey(int key) {
^
C:\ANDROID\smali\util\src\main\java\org\jf\util\SparseIntArray.java:200:
warning: no @param for value
public int indexOfValue(int value) {
^
C:\ANDROID\smali\util\src\main\java\org\jf\util\SparseIntArray.java:200:
warning: no @return
public int indexOfValue(int value) {
^
C:\ANDROID\smali\util\src\main\java\org\jf\util\SparseIntArray.java:219:
warning: no @param for key
public void append(int key, int value) {
^
C:\ANDROID\smali\util\src\main\java\org\jf\util\SparseIntArray.java:219:
warning: no @param for value
public void append(int key, int value) {
^
C:\ANDROID\smali\util\src\main\java\org\jf\util\SparseIntArray.java:52:
warning: no @param for initialCapacity
public SparseIntArray(int initialCapacity) {
^
C:\ANDROID\smali\util\src\main\java\ds\tree\RadixTree.java:53: warning: no
description for @throws
* @throws DuplicateKeyException
^
C:\ANDROID\smali\util\src\main\java\ds\tree\RadixTree.java:60: warning: no
description for @return
* @return
^
C:\ANDROID\smali\util\src\main\java\ds\tree\RadixTree.java:109: error: bad use
of '>'
* complete("b") -> return "blah"
^
C:\ANDROID\smali\util\src\main\java\ds\tree\RadixTreeImpl.java:327: warning: no
@param for <R>
public <R> void visit(String key, Visitor<T, R> visitor) {
^
C:\ANDROID\smali\util\src\main\java\ds\tree\RadixTreeImpl.java:426: error: bad
use of '>'
* complete("b") -> return "blah"
^
C:\ANDROID\smali\util\src\main\java\ds\tree\Visitor.java:36: error: '>' expected
* @param <T,R>
^
C:\ANDROID\smali\util\src\main\java\ds\tree\VisitorImpl.java:5: error:
reference not found
* A simple standard implementation for a {@link visitor}.
^
C:\ANDROID\smali\util\src\main\java\ds\tree\VisitorImpl.java:8: error: '>'
expected
* @param <T,R>
^
:util:javadoc FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':util:javadoc'.
> Javadoc generation failed.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.
BUILD FAILED
Total time: 6.88 secs
Original comment by tifo...@gmail.com
on 30 Nov 2014 at 7:18
Ah, those appear to be javadoc issues. try gradlew.bat build -x :util:javadoc
(or maybe "-x javadoc" or similar)
I should probably get those fixed :)
Original comment by jesusfreke@jesusfreke.com
on 30 Nov 2014 at 8:01
gradlew.bat build -x javadoc
Build successfully, but with a lot of warnings throughout the process. Just
hope none of them are reason to not be able to deodex my files.
Gonna try it right away.
Thanks for your guidance.
Original comment by tifo...@gmail.com
on 30 Nov 2014 at 8:23
Still no luck...
I was hoping that inline.txt provided here would be the same for my device.
Seems it's not. Will have to build deodexerant and push it to my device.
...sighs...
Original comment by tifo...@gmail.com
on 30 Nov 2014 at 8:41
I'm sorry but, can anyone build deodexerant for me, please? It's just that,
since my last comment (yesterday) I'm still syncing AOSP repo...it hasn't
finished yet.
I've synced with master branch...was that wrong?
Original comment by tifo...@gmail.com
on 1 Dec 2014 at 11:12
I gave up. The sync just didn't finished.
In the meantime, I've tried an automated tool that I've found on XDA:
http://forum.xda-developers.com/showthread.php?t=2213235
Used this tool to deodex my ROM's services.jar, for testing purposes.
Can't quite understand how nor why but it worked. The thing is, all of my jar's
and apk's have a corresponding odex file but, all of them, already have a
classes.dex inside. I don't think this is normal. It's almost like they are not
really odex at all.
I don't understand this.
I've flashed the new services.jar that the tool gave me and my phone is working
normally.
Whaaaattt!?
Original comment by tifo...@gmail.com
on 1 Dec 2014 at 8:10
Original issue reported on code.google.com by
marcwa...@gmail.com
on 28 Jan 2014 at 9:20