[Android Software Development] Typhus_:
Hello!

I was trying to deodex a stock KitKat ROM for a bq Aquaris E5 FHD (it's a Mediatek device - MT6592).

I've faced a lot of errors while using other automated tools and even more errors when I've tried do to it manually.

Decided to try this tool...

Just for testing purposes I've tried to deodex services.jar. The original file already had a classes.dex (should it have??).

The result was this:

Welcome!
Deodexing services.jar
Compression=5
API=19
EXTENSION=jar
1 file(s) copied.
1 file(s) copied.
Disassembling odex file..

Error occurred while disassembling class Lcom.android.server.accessibility.AccessibilityManagerService; - skipping class
java.lang.RuntimeException: Invalid method index: 35
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.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

Error occurred while disassembling class Lcom.android.server.accessibility.TouchExplorer$InjectedPointerTracker; - skipping class
java.lang.RuntimeException: Invalid method index: 36
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.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

Error occurred while disassembling class Lcom.android.server.accessibility.TouchExplorer$ReceivedPointerTracker; - skipping class
java.lang.RuntimeException: Invalid method index: 35
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.writeDirectMethods(ClassDefinition.java:277)
at org.jf.baksmali.Adaptors.ClassDefinition.writeTo(ClassDefinition.java:112)
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.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

Error occurred while disassembling class Lcom.android.server.location.GpsLocationProvider; - skipping class
java.lang.RuntimeException: Invalid method index: 36
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.writeDirectMethods(ClassDefinition.java:277)
at org.jf.baksmali.Adaptors.ClassDefinition.writeTo(ClassDefinition.java:112)
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.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Creating classes.dex file..
out\com\android\server\accessibility\AccessibilityManagerService.smali[4769,0] no viable alternative at input ''
out\com\android\server\accessibility\TouchExplorer$ReceivedPointerTracker.smali[78,0] mismatched input '' expecting END_METHOD_DIRECTIVE
out\com\android\server\accessibility\TouchExplorer$InjectedPointerTracker.smali[87,0] mismatched input '' expecting END_METHOD_DIRECTIVE
out\com\android\server\location\GpsLocationProvider.smali[1947,0] mismatched input '' expecting END_METHOD_DIRECTIVE
1 file(s) copied.

7-Zip (A) 4.65 Copyright (c) 1999-2009 Igor Pavlov 2009-02-03

Processing archive: services.jar

Extracting META-INF
Extracting META-INF\MANIFEST.MF
Extracting classes.dex

Everything is Ok

Folders: 1
Files: 2
Size: 4329347
Compressed: 1904425
Repacking deodexed apk..

7-Zip (A) 4.65 Copyright (c) 1999-2009 Igor Pavlov 2009-02-03
Scanning

Creating archive services.jar

Compressing classes.dex
Compressing META-INF\MANIFEST.MF

Everything is Ok
1 file(s) copied.
DEODEXING COMPLETE!

================COMPLETED DEODEXING===============
===================DEODEXED 1 of 1===============
Done checking 50%
Done checking 100%
Successfully deodexed all files!

As you can see, it showed a lot of errors but still it deodexed the file.

Decided to flash it to my phone and see what happened.

It boots normally. Everything seems to be ok.

So, I wonder, what are those errors? Is this problematic?

--- EDIT---

Why did the original file already had a classes.dex? I'm looking into all my apk's and jar files and, all of them, already have a classes.dex.

Is this normal?

I was looking into other ROM's and there aren't any classes.dex files on them (before deodexing)...weird.

--- EDIT 2---

Decided to go further and do the same for SystemUI and Settings. The result is the same:

1 - A lot of errors while trying to deodex.

2 - No classes.dex created (smali can't do it because of baksmali errors)

3 - 7Zip get's in the way and extracts everything

4 - Classes.dex is found (it was always there...)

7 - New apk is created

8 - Flashd it into my phone

9 - Everything runs normally

So my guess is, my ROM is not really odexed. Somewhere along the building phase the odex files were created (only to speed up boot and save space) but the original classes.dex were not removed.

As anyone else came across something like this before?