[Tool] (v5.0) Fully automated tool for create deodex from ART (Nougat support)

_riddle

Member
Dec 19, 2014
9
48
0
Taoyuan
Surprise to see my patch appears here...
Thanks to baksmali/smali author jesusfreke, the source has nice structure that is easy to extend.

For who may interest about the oat file format:
(Actually it is elf, oat header start from 4k address)
androidxref.com/5.0.0_r2/xref/art/compiler/oat_writer.h#34

The dex in oat file should be odex (not the same as dalvik) format.
Reference: androidxref.com/5.0.0_r2/xref/art/compiler/dex/dex_to_dex_compiler.cc
As below sample, optimized dex uses vtable offset to save function resolving time.

Correct(source) content
Code:
    .line 76
    const-class v1, [I
    invoke-virtual {v1}, Ljava/lang/Class;->getComponentType()Ljava/lang/Class;
    move-result-object v1
    sput-object v1, TYPE:Ljava/lang/Class;
Odex content (Only extract from oat will get this)
Code:
    .line 76
    const-class v1, [I
    invoke-virtual/range-quick {v1}, [email protected]
    move-result-object v1
    sput-object v1, TYPE:Ljava/lang/Class;
Use original baksmali to force convert art's odex will get wrong instruction.
Pack these content to device will result unexpected runtime error.
Code:
    .line 76
    const-class v1, [I
    iput-wide-volatile v0, v1, Landroid/system/OsConstants;->CAP_DAC_READ_SEARCH:I
    move v0, v0
    move-result-object v1
    sput-object v1, TYPE:Ljava/lang/Class;
About the purpose of the tools I made.
It is to convert oat to legacy dex that allow original baksmali without patch can deassemble it correctly.

For example: SystemUI.odex (Actually it is an oat file)
1. Get odex/dex boot class
Code:
java -jar oat2dex.jar boot boot.oat
2. Deodex application (The parameter "odex" is folder path from step 1)
As dalvik, deodex application's odex will need to reference boot class to resolve what vtable mapping to.
Code:
java -jar oat2dex.jar SystemUI.odex odex
3. Deassemble the output of step 2 by original baksmali.

I only test on AOSP version, I am not sure whether manufacturer modified their own format.
If it does not work correctly, I have no idea without detail information (provide file, error message...).
 

Attachments

tdunham

Recognized Contributor
Jun 21, 2008
13,686
36,462
0
TampaBay
1. Get odex/dex boot class
Code:
java -jar oat2dex.jar boot boot.oat
@_riddle
Step 1 provides java.io.FileNotFoundException: boot (The system cannot find not find the file specified). Boot.oat file is placed in same work folder that I am running command prompt for commanline functions (under MS Windows).
And I think it is a necessary requisite before attempting #2 correct?

---------- Post added at 10:21 PM ---------- Previous post was at 09:47 PM ----------

Ok, I think step 1 is to get bootclasspath but no success there with boot.oat file.

---------- Post added at 10:26 PM ---------- Previous post was at 10:21 PM ----------

To get bootclasspath with ADB:
adb shell set > d:/bootclasspath.txt
(the '> d:/bootclasspath.txt' was to redirect display output to a text file for use later, otherwise it just displays on the screen)

---------- Post added at 10:29 PM ---------- Previous post was at 10:26 PM ----------

Raw output. Paths will need to be edited for use for deodexing.
Code:
BOOTCLASSPATH=/system/framework/core-libart.jar:/system/framework/conscrypt.jar:/system/framework/okhttp.jar:/system/framework/core-junit.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/telephony-common.jar:/system/framework/voip-common.jar:/system/framework/ims-common.jar:/system/framework/mms-common.jar:/system/framework/android.policy.jar:/system/framework/apache-xml.jar:/system/framework/sec_edm.jar:/system/framework/timakeystore.jar:/system/framework/seccamera.jar:/system/framework/scrollpause.jar:/system/framework/stayrotation.jar:/system/framework/smartfaceservice.jar:/system/framework/commonimsinterface.jar:/system/framework/imsmanager.jar:/system/framework/sprengine.jar:/system/framework/smartbondingservice.jar:/system/framework/secocsp.jar:/system/framework/secEmailBC.jar:/system/framework/simageis.jar:/system/framework/qcmediaplayer.jar:/system/framework/WfdCommon.jar:/system/framework/oem-services.jar:/system/framework/org.codeauro
Here is a really good guide explaining about deodexing, api levels, commandline, bootclasspaths etc...

[GUIDE] Deodexing APKs Manually
 
Last edited:

_riddle

Member
Dec 19, 2014
9
48
0
Taoyuan
@_riddle
Step 1 provides java.io.FileNotFoundException: boot (The system cannot find not find the file specified). Boot.oat file is placed in same work folder that I am running command prompt for commanline functions (under MS Windows).
From the error message, it looks like the input file name is "boot".
Did you miss the file extension ("boot.oat" or "boot")?

And in art, it is not necessary to get bootclasspath manually.
boot.oat is compiled with all boot class path jars.
Once extract all dex from it, we have all boot classes.
 
  • Like
Reactions: Golv

Golv

Recognized Developer
Jan 17, 2012
2,113
4,395
203
@_riddle
Thx for your great work!
Could I need deassemble with baksmali output files from boot from /odex/*.dex or from /dex/*.dex for correct deoxed framework's *.jar?
Files from which folder do I need deassemble?

.......
boot.oat is compiled with all boot class path jars.
Once extract all dex from it, we have all boot classes.
Or can I rename each of the files in /dex/*.dex to classes.dex and to add this classes.dex in matching * .jar?
For example:
after successful:
Code:
java -jar oat2dex.jar boot boot.oat
/dex/android.policy.dex rename -> classes.dex and pack into android.policy.jar (with 7za)
Is that correct?

---------- Post added at 03:16 ---------- Previous post was at 02:35 ----------

@_riddle
I deodexed 1 file - SystemUI.apk and added it to the odex system for verification. Phone booted successfully and runs without errors (HTC One M7 with Google Play edition Android 5.0.1)
THANK YOU !!!
Now I need to check all odexed jar's from framework and all jar's from framework with odex from framework/boot.oat (That was my question in a previous post ...) ...
 

Golv

Recognized Developer
Jan 17, 2012
2,113
4,395
203
Only one of all Odex files (from framework, app and priv-app) with error:

g:\oat2dex>java -jar oat2dex.jar Launcher2.odex odex
12-21 07:55:01:793 Preparing bootclasspath from odex
12-21 07:55:03:088 De-optimizing /system/priv-app/Launcher2/Launcher2.apk
Exception in thread "main" org.jf.util.ExceptionWithContext: Unsupported instruction format: Format22cs
at org.jf.dexlib2.writer.DexWriter.writeCodeItem(DexWriter.java:1008)
at org.jf.dexlib2.writer.DexWriter.writeDebugAndCodeItems(DexWriter.java:769)
at org.jf.dexlib2.writer.DexWriter.writeTo(DexWriter.java:222)
at org.jf.dexlib2.writer.DexWriter.writeTo(DexWriter.java:200)
at org.jf.dexlib2.writer.pool.DexPool.writeTo(DexPool.java:99)
at dext.OatUtil.extractToDex(OatUtil.java:271)
at dext.OatUtil.oat2dex(OatUtil.java:140)
at dext.OatUtil.main(OatUtil.java:160)

Odex original and apk - attached here: Launcher2.rar
@_riddle Could you see this app and odex? Why the error occurred and what can be done?
THX!!!
 

Golv

Recognized Developer
Jan 17, 2012
2,113
4,395
203
Cheers!
I've my full DEODEXed ROM now, except Launcher2.apk (with Launcher2.odex)
Ffirst I was left in the /system /priv-app only odex Launcer.apk and /arm/Launcher.odex and removed from the /system/framework all /arm folder.
Phone successfully loaded, but gave error Laucher.
Then I added into /system/framework/arm folder two files: boot.oat and boot.art
The phone has successfully boot WITHOUT any errors. As a result, there is only one odex Launcher2.apk in the system. But I think it's no problem! Everything will be decided in the future!
Great respect @_riddle and other for their great work!
 
Last edited:

svadev

Senior Member
Dec 13, 2014
133
481
93
Surprise to see my patch appears here...
Thanks to baksmali/smali author jesusfreke, the source has nice structure that is easy to extend.

For who may interest about the oat file format:
(Actually it is elf, oat header start from 4k address)
androidxref.com/5.0.0_r2/xref/art/compiler/oat_writer.h#34

The dex in oat file should be odex (not the same as dalvik) format.
Reference: androidxref.com/5.0.0_r2/xref/art/compiler/dex/dex_to_dex_compiler.cc
As below sample, optimized dex uses vtable offset to save function resolving time.

Correct(source) content
Code:
    .line 76
    const-class v1, [I
    invoke-virtual {v1}, Ljava/lang/Class;->getComponentType()Ljava/lang/Class;
    move-result-object v1
    sput-object v1, TYPE:Ljava/lang/Class;
Odex content (Only extract from oat will get this)
Code:
    .line 76
    const-class v1, [I
    invoke-virtual/range-quick {v1}, [email protected]
    move-result-object v1
    sput-object v1, TYPE:Ljava/lang/Class;
Use original baksmali to force convert art's odex will get wrong instruction.
Pack these content to device will result unexpected runtime error.
Code:
    .line 76
    const-class v1, [I
    iput-wide-volatile v0, v1, Landroid/system/OsConstants;->CAP_DAC_READ_SEARCH:I
    move v0, v0
    move-result-object v1
    sput-object v1, TYPE:Ljava/lang/Class;
About the purpose of the tools I made.
It is to convert oat to legacy dex that allow original baksmali without patch can deassemble it correctly.

For example: SystemUI.odex (Actually it is an oat file)
1. Get odex/dex boot class
Code:
java -jar oat2dex.jar boot boot.oat
2. Deodex application (The parameter "odex" is folder path from step 1)
As dalvik, deodex application's odex will need to reference boot class to resolve what vtable mapping to.
Code:
java -jar oat2dex.jar SystemUI.odex odex
3. Deassemble the output of step 2 by original baksmali.

I only test on AOSP version, I am not sure whether manufacturer modified their own format.
If it does not work correctly, I have no idea without detail information (provide file, error message...).
@_riddle:
I try to use your tool for Samsung S5 and have get error.
Here is error, boot.oat, SystemUI.odex : ftp://79.120.63.235/err_oat2dex.zip

Added:
in Samsung boot.oat - oat header contains two additional fields:
oat_create_commands_info_size : uint32; // length of oat create command in bytes
oat_create_command:[FONT=&quot] ubyte[[/FONT][FONT=&quot]oat_create_commands_info_size] ; // aot create command command

and only after this follow dex files headers
[/FONT]
 
Last edited:
  • Like
Reactions: _alexndr

_riddle

Member
Dec 19, 2014
9
48
0
Taoyuan
@_riddle:
I try to use your tool for Samsung S5 and have get error.
Here is error, boot.oat, SystemUI.odex : ftp://79.120.63.235/err_oat2dex.zip

Added:
in Samsung boot.oat - oat header contains two additional fields:
oat_create_commands_info_size : uint32; // length of oat create command in bytes
oat_create_command:[FONT=&quot] ubyte[[/FONT][FONT=&quot]oat_create_commands_info_size] ; // aot create command command

and only after this follow dex files headers
[/FONT]
@svadev
Thanks for the information.
Finally I add a rough workaround to compatible with Samsung's format:
Read more 4 bytes as methods_offsets_ of structure OatDexFile when read unreasonable dex size.
Please try the attachment.
 

Attachments

Last edited:
  • Like
Reactions: _alexndr and svadev

svadev

Senior Member
Dec 13, 2014
133
481
93
@svadev
Thanks for the information.
Finally I add a rough workaround to compatible with Samsung's format:
Read more 4 bytes as methods_offsets_ of structure OatDexFile when read unreasonable dex size.
Please try the attachment.
Thanks!

It works finely for boot.oat and others apk!
 

_riddle

Member
Dec 19, 2014
9
48
0
Taoyuan
@_riddle
Thx for your great work!
Could I need deassemble with baksmali output files from boot from /odex/*.dex or from /dex/*.dex for correct deoxed framework's *.jar?
Files from which folder do I need deassemble?
The output odex folder is just temporary. It can be deleted once dex files were generated.
To deopt application, use "java -jar oat2dex.jar app.odex dex" will also work.

I added a easier function to get deodexed jars, but currently only include boot jars.
java -jar oat2dex_v03.jar auto
It will get all boot jar related files and generate deodexed jars to folder "result-jar".
(It will need to connect device and adb executable in environment path or same folder to work.)
 

Attachments

svadev

Senior Member
Dec 13, 2014
133
481
93
The output odex folder is just temporary. It can be deleted once dex files were generated.
To deopt application, use "java -jar oat2dex.jar app.odex dex" will also work.

I added a easier function to get deodexed jars, but currently only include boot jars.
java -jar oat2dex_v03.jar auto
It will get all boot jar related files and generate deodexed jars to folder "result-jar".
(It will need to connect device and adb executable in environment path or same folder to work.)
@_riddle
Can you also make so that you can specify the folder /system on the disk so it took the files and not from the device
 

Golv

Recognized Developer
Jan 17, 2012
2,113
4,395
203
Thank you for the new version, but the previous works fine for me except for error with file, which I wrote and gave a link. For myself, I wrote script for dos for automatic decompile and deodex all apk and jar or only selected app. Everything from deodexed rom is working fine all this day. Only issue with the above file. If you will be able to see it - it would be great! I can upload boot.oat, if you need..
Code:
g:\oat2dex>java -jar oat2dex.jar Launcher2.odex odex
12-21 07:55:01:793 Preparing bootclasspath from odex
12-21 07:55:03:088 De-optimizing /system/priv-app/Launcher2/Launcher2.apk
Exception in thread "main" org.jf.util.ExceptionWithContext: Unsupported instruction format: Format22cs
at org.jf.dexlib2.writer.DexWriter.writeCodeItem(DexW riter.java:1008)
at org.jf.dexlib2.writer.DexWriter.writeDebugAndCodeI tems(DexWriter.java:769)
at org.jf.dexlib2.writer.DexWriter.writeTo(DexWriter. java:222)
at org.jf.dexlib2.writer.DexWriter.writeTo(DexWriter. java:200)
at org.jf.dexlib2.writer.pool.DexPool.writeTo(DexPool .java:99)
at dext.OatUtil.extractToDex(OatUtil.java:271)
at dext.OatUtil.oat2dex(OatUtil.java:140)
at dext.OatUtil.main(OatUtil.java:160)
 
Last edited:

_riddle

Member
Dec 19, 2014
9
48
0
Taoyuan
@svadev
try: java -jar oat2dex_v04.jar auto <system-folder>
@Golv
Try Launcher again.
In this case, I print some messages like below, but it should be ok.
Risky resolved field from debug info. class=Lcom/android/launcher2/AppsCustomizePagedView; method=syncWidgetPageItems field-type=Landroid/content/pm/ResolveInfo; instruction-address=345

Due to check-cast is optimized out to 2 nop, and v21 is assigned by java/lang/Object, v14 has no information to refer its type that caused error.
[odex content of com.android.launcher2.AppsCustomizePagedView :: syncWidgetPageItems]

.line 1192
invoke-virtual {v9, v13}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;
move-result-object v21
...
move-object/from16 v14, v21
.line 1214
nop
nop
.line 1215
.local v14, "info":Landroid/content/pm/ResolveInfo;
new-instance v12, Lcom/android/launcher2/PendingAddShortcutInfo;
.end local v12 # "createItemInfo":Lcom/android/launcher2/PendingAddItemInfo;
iget-object-quick v2, v14, [email protected]

After recover it from debug info, it looks correct.
[deodexed content]
...
new-instance v12, Lcom/android/launcher2/PendingAddShortcutInfo;
.end local v12 # "createItemInfo":Lcom/android/launcher2/PendingAddItemInfo;
iget-object v2, v14, Landroid/content/pm/ResolveInfo;->activityInfo:Landroid/content/pm/ActivityInfo;
 

Attachments

Golv

Recognized Developer
Jan 17, 2012
2,113
4,395
203
@svadev
try: java -jar oat2dex_v04.jar auto <system-folder>

@Golv
Try Launcher again.
In this case, I print some messages like below, but it should be ok.
Risky resolved field from debug info. class=Lcom/android/launcher2/AppsCustomizePagedView; method=syncWidgetPageItems field-type=Landroid/content/pm/ResolveInfo; instruction-address=345

Due to check-cast is optimized out to 2 nop, and v21 is assigned by java/lang/Object, v14 has no information to refer its type that caused error.
[odex content of com.android.launcher2.AppsCustomizePagedView :: syncWidgetPageItems]

.line 1192
invoke-virtual {v9, v13}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;
move-result-object v21
...
move-object/from16 v14, v21
.line 1214
nop
nop
.line 1215
.local v14, "info":Landroid/content/pm/ResolveInfo;
new-instance v12, Lcom/android/launcher2/PendingAddShortcutInfo;
.end local v12 # "createItemInfo":Lcom/android/launcher2/PendingAddItemInfo;
iget-object-quick v2, v14, [email protected]

After recover it from debug info, it looks correct.
[deodexed content]
...
new-instance v12, Lcom/android/launcher2/PendingAddShortcutInfo;
.end local v12 # "createItemInfo":Lcom/android/launcher2/PendingAddItemInfo;
iget-object v2, v14, Landroid/content/pm/ResolveInfo;->activityInfo:Landroid/content/pm/ActivityInfo;

@_riddle
With this version oat2dex_v04.jar - all is OK for Launcher2.apk.
This app was deodexed and after that ALL deodexed system works!
THANK YOU for great work!!! :good:
 

svadev

Senior Member
Dec 13, 2014
133
481
93
Four files de-optimazing with error

@svadev
try: java -jar oat2dex_v04.jar auto <system-folder>
@_riddle

Big thanks for your work!

In last oat2dex and previous for four files (maps.odex, Music2.odex, DocumentService.odex, SamsungLinkPlatform.odex) de-optimazing with error.
But in last v4 (oat2dex_v04.jar) still many others files (books.odex, chaton, drive.odex, drivelink.odex, flipboard.odex, headlines.odex...) de-optimazing with error and
errorlevel with java -jar oat2dex-v04.jar boot boot.oat is 1 and in folder DEX only 6 files (bouncycastle.dex, conscrypt.dex, core-junit.dex, core-libart.dex, ext.dex, okhttp.dex). And v4 work very long.
Please, correct it and return to v2. auto param not needed, because it works only with boot.oat, but not with all /system folder.
We can write batch code for oat2dex.jar which will work with whole /system folder.

Big thanks to you!

Here is these four files: ftp://79.120.63.235/for_file_with_error.zip

Code:
H:\deodex>java -jar oat2dex.jar Maps.odex odex
12-23 09:05:13:025 Preparing bootclasspath from odex
12-23 09:05:13:228 De-optimizing /system/app/Maps/Maps.apk
12-23 09:05:16:181 Analysis error in class=Lcom/google/android/apps/gmm/map/util/d; method=<clinit>
12-23 09:05:16:181 org.jf.dexlib2.analysis.AnalysisException: Could not resolve the field in class Lcom/google/android/apps/gmm/map/util/e; at offset 24 in <clinit>
        at org.jf.dexlib2.analysis.MethodAnalyzer.analyzeIputIgetQuick(MethodAnalyzer.java:1561)
        at org.jf.dexlib2.analysis.MethodAnalyzer.analyzeInstruction(MethodAnalyzer.java:968)
        at org.jf.dexlib2.analysis.MethodAnalyzer.analyze(MethodAnalyzer.java:205)
        at org.jf.dexlib2.analysis.MethodAnalyzer.<init>(MethodAnalyzer.java:140)
        at dext.OatUtil$OatDexRewriter$1$1.getInstructions(OatUtil.java:596)
        at org.jf.dexlib2.writer.pool.ClassPool.internCode(ClassPool.java:143)
        at org.jf.dexlib2.writer.pool.ClassPool.intern(ClassPool.java:125)
        at org.jf.dexlib2.writer.pool.DexPool.writeTo(DexPool.java:97)
        at dext.OatUtil.extractToDex(OatUtil.java:322)
        at dext.OatUtil.oat2dex(OatUtil.java:195)
        at dext.OatUtil.main(OatUtil.java:71)
opcode: iget-quick
code address: 1492
method: Lcom/google/android/apps/gmm/map/util/d;-><clinit>()V


Exception in thread "main" org.jf.util.ExceptionWithContext: Unsupported instruction format: Format22cs
        at org.jf.dexlib2.writer.DexWriter.writeCodeItem(DexWriter.java:1008)
        at org.jf.dexlib2.writer.DexWriter.writeDebugAndCodeItems(DexWriter.java:769)
        at org.jf.dexlib2.writer.DexWriter.writeTo(DexWriter.java:222)
        at org.jf.dexlib2.writer.DexWriter.writeTo(DexWriter.java:200)
        at org.jf.dexlib2.writer.pool.DexPool.writeTo(DexPool.java:99)
        at dext.OatUtil.extractToDex(OatUtil.java:322)
        at dext.OatUtil.oat2dex(OatUtil.java:195)
        at dext.OatUtil.main(OatUtil.java:71)




H:\deodex>java -jar oat2dex.jar Music2.odex odex
12-23 09:07:10:915 Preparing bootclasspath from odex
12-23 09:07:11:103 De-optimizing /system/app/Music2/Music2.apk
vtableIndex=76 vtable.size()=75
vtableIndex=75 vtable.size()=75
vtableIndex=76 vtable.size()=75
vtableIndex=83 vtable.size()=75
vtableIndex=83 vtable.size()=75
vtableIndex=83 vtable.size()=75
vtableIndex=90 vtable.size()=75
12-23 09:07:16:462 Analysis error in class=Lcom/google/android/music/utils/MusicUtils; method=getSongListRadioMixDescrip
tor
12-23 09:07:16:509 org.jf.dexlib2.analysis.AnalysisException: Could not resolve the method in class Lcom/google/android/
music/medialist/SongList; at index 90
        at org.jf.dexlib2.analysis.MethodAnalyzer.analyzeInvokeVirtualQuick(MethodAnalyzer.java:1659)
        at org.jf.dexlib2.analysis.MethodAnalyzer.analyzeInstruction(MethodAnalyzer.java:976)
        at org.jf.dexlib2.analysis.MethodAnalyzer.analyze(MethodAnalyzer.java:205)
        at org.jf.dexlib2.analysis.MethodAnalyzer.<init>(MethodAnalyzer.java:140)
        at dext.OatUtil$OatDexRewriter$1$1.getInstructions(OatUtil.java:596)
        at org.jf.dexlib2.writer.pool.ClassPool.internCode(ClassPool.java:143)
        at org.jf.dexlib2.writer.pool.ClassPool.intern(ClassPool.java:125)
        at org.jf.dexlib2.writer.pool.DexPool.writeTo(DexPool.java:97)
        at dext.OatUtil.extractToDex(OatUtil.java:322)
        at dext.OatUtil.oat2dex(OatUtil.java:195)
        at dext.OatUtil.main(OatUtil.java:71)
opcode: invoke-virtual/range-quick
code address: 247
method: Lcom/google/android/music/utils/MusicUtils;->getSongListRadioMixDescriptor(Landroid/content/Context;Lcom/google/
android/music/medialist/SongList;Z)Lcom/google/android/music/mix/MixDescriptor;


Exception in thread "main" org.jf.util.ExceptionWithContext: Unsupported instruction format: Format35ms
        at org.jf.dexlib2.writer.DexWriter.writeCodeItem(DexWriter.java:1008)
        at org.jf.dexlib2.writer.DexWriter.writeDebugAndCodeItems(DexWriter.java:769)
        at org.jf.dexlib2.writer.DexWriter.writeTo(DexWriter.java:222)
        at org.jf.dexlib2.writer.DexWriter.writeTo(DexWriter.java:200)
        at org.jf.dexlib2.writer.pool.DexPool.writeTo(DexPool.java:99)
        at dext.OatUtil.extractToDex(OatUtil.java:322)
        at dext.OatUtil.oat2dex(OatUtil.java:195)
        at dext.OatUtil.main(OatUtil.java:71)






H:\deodex>java -jar oat2dex.jar DocumentService.odex  odex
12-23 09:08:39:650 Preparing bootclasspath from odex
12-23 09:08:39:837 De-optimizing /system/priv-app/DocumentService/DocumentService.apk
12-23 09:08:41:634 Analysis error in class=Lorg/apache/index/poi/hslf/record/RecordTypes; method=<clinit>
12-23 09:08:41:634 org.jf.dexlib2.analysis.AnalysisException: Could not resolve the field in class Ljava/lang/Object; at
 offset 8 in <clinit>
        at org.jf.dexlib2.analysis.MethodAnalyzer.analyzeIputIgetQuick(MethodAnalyzer.java:1561)
        at org.jf.dexlib2.analysis.MethodAnalyzer.analyzeInstruction(MethodAnalyzer.java:968)
        at org.jf.dexlib2.analysis.MethodAnalyzer.analyze(MethodAnalyzer.java:205)
        at org.jf.dexlib2.analysis.MethodAnalyzer.<init>(MethodAnalyzer.java:140)
        at dext.OatUtil$OatDexRewriter$1$1.getInstructions(OatUtil.java:596)
        at org.jf.dexlib2.writer.pool.ClassPool.internCode(ClassPool.java:143)
        at org.jf.dexlib2.writer.pool.ClassPool.intern(ClassPool.java:125)
        at org.jf.dexlib2.writer.pool.DexPool.writeTo(DexPool.java:97)
        at dext.OatUtil.extractToDex(OatUtil.java:322)
        at dext.OatUtil.oat2dex(OatUtil.java:195)
        at dext.OatUtil.main(OatUtil.java:71)
opcode: iget-object-quick
code address: 1132
method: Lorg/apache/index/poi/hslf/record/RecordTypes;-><clinit>()V


12-23 09:08:42:322 Analysis error in class=Lorg/apache/poi/hslf/record/RecordTypes; method=<clinit>
12-23 09:08:42:322 org.jf.dexlib2.analysis.AnalysisException: Could not resolve the field in class Ljava/lang/Object; at
 offset 8 in <clinit>
        at org.jf.dexlib2.analysis.MethodAnalyzer.analyzeIputIgetQuick(MethodAnalyzer.java:1561)
        at org.jf.dexlib2.analysis.MethodAnalyzer.analyzeInstruction(MethodAnalyzer.java:968)
        at org.jf.dexlib2.analysis.MethodAnalyzer.analyze(MethodAnalyzer.java:205)
        at org.jf.dexlib2.analysis.MethodAnalyzer.<init>(MethodAnalyzer.java:140)
        at dext.OatUtil$OatDexRewriter$1$1.getInstructions(OatUtil.java:596)
        at org.jf.dexlib2.writer.pool.ClassPool.internCode(ClassPool.java:143)
        at org.jf.dexlib2.writer.pool.ClassPool.intern(ClassPool.java:125)
        at org.jf.dexlib2.writer.pool.DexPool.writeTo(DexPool.java:97)
        at dext.OatUtil.extractToDex(OatUtil.java:322)
        at dext.OatUtil.oat2dex(OatUtil.java:195)
        at dext.OatUtil.main(OatUtil.java:71)
opcode: iget-object-quick
code address: 1385
method: Lorg/apache/poi/hslf/record/RecordTypes;-><clinit>()V


Exception in thread "main" org.jf.util.ExceptionWithContext: Unsupported instruction format: Format22cs
        at org.jf.dexlib2.writer.DexWriter.writeCodeItem(DexWriter.java:1008)
        at org.jf.dexlib2.writer.DexWriter.writeDebugAndCodeItems(DexWriter.java:769)
        at org.jf.dexlib2.writer.DexWriter.writeTo(DexWriter.java:222)
        at org.jf.dexlib2.writer.DexWriter.writeTo(DexWriter.java:200)
        at org.jf.dexlib2.writer.pool.DexPool.writeTo(DexPool.java:99)
        at dext.OatUtil.extractToDex(OatUtil.java:322)
        at dext.OatUtil.oat2dex(OatUtil.java:195)
        at dext.OatUtil.main(OatUtil.java:71)




H:\deodex>java -jar oat2dex.jar SamsungLinkPlatform.odex odex
12-23 09:10:08:025 Preparing bootclasspath from odex
12-23 09:10:08:212 De-optimizing /system/priv-app/SamsungLinkPlatform/SamsungLinkPlatform.apk
Exception in thread "main" org.jf.util.ExceptionWithContext: Unsupported instruction format: Format35ms
        at org.jf.dexlib2.writer.DexWriter.writeCodeItem(DexWriter.java:1008)
        at org.jf.dexlib2.writer.DexWriter.writeDebugAndCodeItems(DexWriter.java:769)
        at org.jf.dexlib2.writer.DexWriter.writeTo(DexWriter.java:222)
        at org.jf.dexlib2.writer.DexWriter.writeTo(DexWriter.java:200)
        at org.jf.dexlib2.writer.pool.DexPool.writeTo(DexPool.java:99)
        at dext.OatUtil.extractToDex(OatUtil.java:322)
        at dext.OatUtil.oat2dex(OatUtil.java:195)
        at dext.OatUtil.main(OatUtil.java:71)
 
Last edited:
  • Like
Reactions: Golv

svadev

Senior Member
Dec 13, 2014
133
481
93
@svadev
Try to run in command line:
Code:
 java -Xmx1024m -jar oat2dex-v04.jar boot boot.oat
Thanks, with command line and -Xmx1024m v04 works.
But for four files (maps.odex, Music2.odex, DocumentService.odex, SamsungLinkPlatform.odex) de-optimazing still done with errors.

New version of tool (now fully worked) posted in post #1.
Big thanks @_riddle!
 
Last edited:
  • Like
Reactions: _alexndr

svadev

Senior Member
Dec 13, 2014
133
481
93
Tested

Thanks :D but most of apps in /app and /priv-app does not contain classes.dex inside after passing the whole procedure... (e.g. SamsungCamera3.apk, SecMms_Candy.apk ...)
Now i tested tool with 5.0 (L7) for S5 - all work finely, except -
maps.odex, Music2.odex, DocumentService.odex, SamsungLinkPlatform.odex - de-optimazing still done with errors.