Updated Post: http://codexplo.wordpress.com/2013/03/22/how-to-decompile-android-apk-to-java-source-code-2/
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-
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.
That all.
I think you enjoy it.
Pingback: Latest-Tutorial » Spring 3 Hello World Example » Latest-Tutorial
Hello. How do you do the step 5? Where do you set the argument to your apk file?
right click on your project, goto run as, then select run configuration..
right click>Run As>Run Configuration..
I hope you will get it now .
Take a look at AndroChef Java Decompiler: http://www.neshkov.com/ac_decompiler.html
It is much easier.
But nowadays people are obfuscating there code , so after decompiling also it will not help us. Do u have any solution for this.
decompiling obfuscating code would be difficult. sorry i have no idea right now, if i get the solution, surely i will post the solution here, stay tuned. thanks.
This is a great start but the instructions are very incomplete. Step 5 was the worst for the argument. What you should do is go to the Argument tab, select File promt and click OK, then apply. Then Run. It will prompt you for the location of the .APK file. Then it will finally create the jar file.
Uuseefull link
about step 7. no, i actually don’t know how to get java source from jar. that’s why i read your article. which was helpful, but not straightforward. next time try not to skip with the details. what might seems simple and clear to one, not always the same for the other.
thanks anyway
Yes, I agree with you 100%
hey can you just read my previous post. It was 2nd part of that tutorial . http://codexplo.wordpress.com/2012/03/15/java-decompiler/
any way thanks for reading..
Hi Bazlur Rahman,
I ‘ve problem which not clearly in step 5. I ‘ve already seen the picture in step 4.
But I don’t know that how to set Argument after select Argument tab? Please show me the picture.
just write facebook.apk on the argument tabs text area, it will work..
impossible de trouver ou charger la classe principale com.googlecode.dex2jar.v3.Main!!!!!!!!
Please write in English… thanks
i have completed .apk to .jar , i want to know how to get java source from jar ……
Follow this link
http://codexplo.wordpress.com/2012/03/15/java-decompiler/
thank you …..
You’re welcome
you can like facebook my page now
Thank u. Helped me a lot to Develop a app in One Day
You’re welcome
you can like my facebook page now
how to decompile xml files alone from .apk without using java decompiler….
please explain how to set the argument in 5 th step……..
yes way, nicely worked! but i am getting $ sign in file names. for eg: original HomeForm.java results in HomeForm.java, HomeForm1.java and HomeForm2.java.
are these files part of code or should i delete those files and keep only HomeForm.java?
hi it is very usefull
But one dought … Emulator is Working or not Bluetooth code
First, thank you for the tutorial. I disagree about ambiguity in step 5. For a novice eclipse user, it wasn’t that hard. I imagine that your tutorial assumes a certain level of proficiency on the part of the student…
That said, may I ask for a bit of guidance?
I followed your steps. I used Windows Explorer to create folder, copy/past .jar files. I told Eclipse to include them and saw them in the project. I set main class to com.googlecode.dex2jar.v3.Main but when I set the argument to my xxxxxxx.apk and clicked run, I received an immediate message: ERROR: com.googlecode.dex2jar.v3.Main could not be found.
Where am I missing a step? I have the Android SDK installed. Should I create the new project as an Android project rather than a java project?
Thanks in advance,
Fulano
hey, I have updated the post, see here http://codexplo.wordpress.com/2013/03/22/how-to-decompile-android-apk-to-java-source-code-2/,
Hey …
I have message in consol like as following:
“this cmd is deprecated, use the d2j-dex2jar if possible
dex2jar version: translator-0.0.9.13
dex2jar file1.dexORapk file2.dexORapk …”
I have followed all above step properly. So please help me asap
how about reading : http://codexplo.wordpress.com/2013/03/22/how-to-decompile-android-apk-to-java-source-code-2/
hey m gettin following error:
do help…
this cmd is deprecated, use the d2j-dex2jar if possible
dex2jar file1.dexORapk file2.dexORapk …
dex2jar version: translator-0.0.9.13
how about reading this: http://codexplo.wordpress.com/2013/03/22/how-to-decompile-android-apk-to-java-source-code-2/
hi, can you also show how to import the decompiled source code in eclipse..
every time i import a decompiled apk folder to the eclipse, the src folder in eclipse shows numerous errors..