I think it’s very often we want to explore the existing projects source code but again sometime it may not be available. Personally I love to dig on existing project to know how people write their codes.
Suddenly I thought, if there is any apk to java source decompiler, it would be a nice thing. You probably know, android runs on dalvik virtual machine, so when we compile android java code, its compile to dex( dalvik executable). So I search a lot to find a way how to convert dex to jar ,and I know already how to decompile jar file to java source code.
At last I found the way out.
Here is the way-
You will need-
- Eclipse IDE
- Java Runtime (of course)
- JD-GUI or JD Eclipse plugin [url for eclipse Plugin http://java.decompiler.free.fr/jd-eclipse/update(or visit http://java.decompiler.free.fr/?q=jdeclipse ) ]
- DexToJar (get them from here: http://code.google.com/p/dex2jar/)
And now follow the steps
Step 1: Create a java project, name it DexToJava.
Step 2: Create a folder and name it libs. Paste all jars file in the libs folder after extracting dex2jar-0.0.9.8.tar.gz . Go to build path. Add all the jars in the build path.
Step 3: You are almost done. Get an apk file and paste it in your project. For me it is facebook.apk.
Step 4: right click on project and select run as. Set main class: com.googlecode.dex2jar.v3.Main
Step 5: Set Argument facebook.apk and now click on apply and run it.
Step 6: after completing the job, you will find on console:
Step 7: now refresh the project, and you will find facebook_dex2jar.jar. And you know already how to get java source from jar. Use JD-GUI.
From jar file extracting code ….. use http://java.decompiler.free.fr/?q=jdgui
That all.
I think you enjoy it.
Related articles
- Java – How to Decompile Class files from Jar Files (clean-clouds.com)
- Creating jar without java source files (daniweb.com)













but the link you mentioned for JD-GUI is not working,can you help in that?
hi dear a day before i do that and on that day links working properly now i don’t know wht happen to that website may be doing some updates or etc ….
anyway visit this may be that help you http://www.java-decompiler.com/
Another option is to use AndroChef Java Decompiler to decompile apk., dex, jar and java class-files. Successfully decompiles obfuscated Java 6 and Java 7 .class and .jar files. It is simple but powerful tool that allows you to decompile Java and Dalvik bytecode (DEX, APK) into readable Java source.
http://www.neshkov.com/ac_decompiler.html