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
- 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.
I think you enjoy it.