snippetjavaCritical
How to decompile DEX into Java source code?
Viewed 0 times
sourcehowjavacodedexdecompileinto
Problem
How can one decompile Android DEX (VM bytecode) files into corresponding Java source code?
Solution
It's easy
Get these tools:
-
dex2jar to translate dex files to jar files
-
jd-gui to view the java files in the jar
The source code is quite readable as dex2jar makes some optimizations.
Procedure:
And here's the procedure on how to decompile:
Step 1:
Convert classes.dex in test_apk-debug.apk to test_apk-debug_dex2jar.jar
Note 1: In the Windows machines all the
Note 2: On linux/mac don't forget about
Note 3: Also, remember to add execute permission to
dex2jar documentation
Step 2:
Open the jar in JD-GUI
Get these tools:
-
dex2jar to translate dex files to jar files
-
jd-gui to view the java files in the jar
The source code is quite readable as dex2jar makes some optimizations.
Procedure:
And here's the procedure on how to decompile:
Step 1:
Convert classes.dex in test_apk-debug.apk to test_apk-debug_dex2jar.jar
d2j-dex2jar.sh -f -o output_jar.jar apk_to_decompile.apk
d2j-dex2jar.sh -f -o output_jar.jar dex_to_decompile.dexNote 1: In the Windows machines all the
.sh scripts are replaced by .bat scriptsNote 2: On linux/mac don't forget about
sh or bash. The full command should be:sh d2j-dex2jar.sh -f -o output_jar.jar apk_to_decompile.apkNote 3: Also, remember to add execute permission to
dex2jar-X.X directory e.g. sudo chmod -R +x dex2jar-2.0dex2jar documentation
Step 2:
Open the jar in JD-GUI
Code Snippets
d2j-dex2jar.sh -f -o output_jar.jar apk_to_decompile.apk
d2j-dex2jar.sh -f -o output_jar.jar dex_to_decompile.dexsh d2j-dex2jar.sh -f -o output_jar.jar apk_to_decompile.apkContext
Stack Overflow Q#1249973, score: 988
Revisions (0)
No revisions yet.