Advertuse

Search This Blog

Your Ad Here

Friday, 8 July 2011

How to decompile Android application to get sourcecode

Hi Friends,
reverse engineering is everywhere. but reverse engineering is meant for  code review of  vulnerable application. so I hope you guys will not  use this reverse engineering  tricks to do any illegal things.
all android application are running  on Dalvik , which is a Virtual Machine having register-base  architecture and different from Java Virtual Machine by sun-microsystem (and now by oracle ) which is stack machine.
hence all android application is consist of Dalvik Executable (.dex).  hence to convert those  android application( *.apk) to source code we have to follow below steps

(Note : apk is packing of  .dex  file and other resources.)

step to decompile

1) convert  .dex file format to  .class file
2) convert  .class file format to  java code file

1) android application will come with .apk file format. which contains  .dex file .
hence  to convert .dex file in to .class file ( and those compress .class files  are placed in .jar file)
one need to have .dex  to  .class file converter .(both are binary format)
you can download such  tool from below link.


 after downloading you need to extract them and it will have following files in you  file system.





















then you open  command prompt and run batch file name dex2jar followed by your  apk file name with full path, if it is not resides on same directory.










then it will convert your  appname.apk file to  appname.apk.dex2jar.jar.

 which is pure bytecode  and can run on  java virtual machine.


 

2)  now you have  .jar file and   to convert this jar to java code there are many java decompilers are available .
but I have used  free one available on internet.  you can download from here
java decomipler

now  use this  compile and it will   generate souce code files for you.


 I hope  you like this  method  to decompile you  favorite android application.
there are such other tools available to decompile or reverse engineering  your android application.


compile by
Divyang Panchasara
Sr. Programmer Analyst
Hitech OutSourcing

16 comments:

Hemant Chnad Dungriyal said...

its works superbly....
thanks

divyang4481 said...

thank you

Anonymous said...

Hey man, Thank you so much for easy-to guide. I pulled my hair out 2 days ago with a different guide, but didn't work for me. Yours worked just in a few minutes. Good luck!

Anonymous said...

i got error java is not recognised as an internal or external command

Saif said...

Thanks!!!!

Unknown said...

thanks dude...it really works..i have been searching in many of the websites..urs is the best abiut it..thank u...all the best wishes in the future..

regards,
perumal

Unknown said...

thanks dude...it really works..i have been searching in many of the websites..urs is the best abiut it..thank u...all the best wishes in the future..

regards,
perumal

Unknown said...
This comment has been removed by the author.
Unknown said...

Thank you

Unknown said...

thank u

Anonymous said...

Good work. I have been searching this for many days. The source code is successfully obtained. Again thanks a lot.

Anonymous said...

Hi Divyang...ur post was of great help..really appreciate...thanks

Anonymous said...

u r a life saver bro thank you alot !!!!!

Anonymous said...

Thnkx

Anonymous said...

dex2jar-0.0.7.10-SNAPSHOT is given me error (java exception has occured).and idea.....

Unknown said...

how to get .dex file from .apk....please tell mee