-
Notifications
You must be signed in to change notification settings - Fork 2.1k
[TOC]
No, dex2jar is a tool for converting Android's .dex format to Java's .class format. just one binary format to another binary format, not to source.
See the User Guide
In version 0.0.7.8 and before, dex2jar use the default memory size of JVM. To translate A dex file that contains very large instruction size will cause the Error. try to add -Xms512m -Xmx1024m to dex2jar.bat or dex2jar.sh
java -Xms512m -Xmx1024m -cp "%CLASSPATH%" pxb.android.dex2jar.v3.Main %*
the d2j-smali/d2j-baksmali have the same function with smali/baksmali.
# disassemble the dex to smali files
d2j-baksmali.sh abc.apk
# assemble smali files to dex
d2j-smali.sh out -o classes.dex
dex2jar also support modify a dex/apk file after it convert to .class file. Here is an Example how to modify a apk file with dex-tools.
alternatives:smali/baksmali,asmdex,dexmaker, they are excellent tools work with dex/odex directly, you should give it a try.
DexFileReader r = new DexFileReader(...);
DexFileNode n = new DexFileNode();
DexFileWriter w = new DexFileWriter();
// reade dex to DexFileNode
r.accept(n);
... // modify DexFileNode here
// copy modified DexFileNode to DexWiter
n.accept(w);
byte[] data = w.toByteArray();
... // save data
See the How to buid dex2jar from source
Please check the version of jdk:
- dex2jar-0.0.9.x require jdk6+
- dex2jar-2.x require jdk7+
dex2jar host an CI server on cloudbees, you can get the nightly here: https://dex2jar.ci.cloudbees.com/job/dex2jar-2.x/lastStableBuild/com.googlecode.dex2jar$dex-tools/
the dx tool from android sdk can do the job
dx --dex --output=classes.dex abc.jar
and the [d2j-jar2dex] from dex2jar also can do the job
d2j-jar2dex.sh --output=classes.dex abc.jar