Dex2JAR is a tool to work with android .dex and java .class files.
dex2jar consists of a collection of Java libraries that can streamline development tasks for Android related concepts and can simplify APK projects.
The download package includes, aside from the set of development libraries, a suite of script files (in BAT format), which can automate various programming tasks.
The components comprised in the package are compiled, therefore they’re ready to use. Of course, you can also modify them to improve functionality as the libraries are open source.
The first one consists of a lightweight API that provides the possibility to read DEX (Dalvik Executable) and ODEX files, which are proprietary formats for Android development.
With the second library, DEX translator, programmers will be able to convert DEX files to ASM format. The principle used by this component uses a DEX reader which optimizes the instructions prior to the conversion operation.
The third one, namely DEX-IR, serves to interpret DEX instructions and is used by the previous DEX component for the DEX reading process.
Last, but not least, DEX-Tools is a multi-purpose library that can work with CLASS files in order to perform tasks such as APK modifications or JAR deobfuscation.
The conclusion is that all of the components work together in order to automate Java and Android programming tasks. In addition, the collection of out-of-the-box scripts make an essential collection of tools that developers can use to manipulate project resources.
d2j-dex 2 jar [options] <file0> [file1 … fileN]
-d,--debug-info translate debug info -e,--exception-file <file> detail exception file, default is $current_dir/[file-name]-error.zip -f,--force force overwrite -h,--help Print this help message -n,--not-handle-exception not handle any exception throwed by dex2jar -o,--output <out-jar-file> output .jar file, default is $current_dir/[file-name]-dex2jar.jar -os,--optmize-synchronized optmize-synchronized -p,--print-ir print ir to Syste.out -r,--reuse-reg reuse regiter while generate java .class file -s same with --topological-sort/-ts -ts,--topological-sort sort block by topological, that will generate more readable code
cyborg@cyborg:~$ d2j-dex2jar -f classes.dex dex2jar classes.dex -> classes-dex2jar.jar