How to decompile android apk to java source code?

The official online color is: #A4C639 . 한국어: 공...

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-

  1. Eclipse IDE
  2. Java Runtime (of course)
  3. JDGUI 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 ) ]
  4. 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.

Create a java project

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.

3 thoughts on “How to decompile android apk to java source code?

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.