Reverse engineer .apk file & decompile Android app
Reverse engineer .apk file & decompile app.
Today we will see how to reverse engineer .apk file & decompile app.
Note: This post is just for curiosity or educational purpose.please don’t use it in any illegal activities.
What is apk file?
Any Android app is made up with combination of bunch of resources,configuration files which constitutes one application just like any windows application or any platform which takes the name based on the platform for which its developed like in Android case its .apk file and for windows its .exe file as we know.
What we will get after decompile( or reverse engineer) apk file.
- We can understand what permissions are used in the app.
- Understand about how app UI is created or organized.
- Libraries and images or any resources used in the app.
- Obfuscated source code(scrambled source code which means android sdk uses tool named Proguard which replaces the source code classes,methods with semantically obscure names.)
Lets start with the steps to reverse engineer .apk file & decompile app
Step A: Things we need to prepare a fine Dinner especially when we are hungry.
- Download dex2jar zip from https://sourceforge.net/projects/dex2jar/
- Download the jd-gui for windows : https://github.com/java-decompiler/jd-gui/releases/download/v1.4.0/jd-gui-windows-1.4.0.zip . For Other platforms http://jd.benow.ca/
Step B: Start decompiling your apk file.
- First get the .apk file from your mobile by taking the backup of the app installed in your phone using any backup app.It will generate a apk file of the app.
- Unzip your dex2jar zip that you have downloaded.
- Copy the apk file into your computer and remember the location.
- Right click on the apk file and unzip the apk. You will see the different folders like assets,manifest and more files.
- But we are interested in classes.dex or.dex file.
- Copy .dex file into dex2jar folder that you have unzipped.
- Now if you are windows user then go to cmd or start the command prompt.
open start menu and type cmd.
- type cd and path of your dex2jar folder or simply type cd and drag and drop your dex2jar folder.
- Now run this command (for windows user)<em><strong> d2j-dex2jar.bat classes.dex . Note: classes.dex is the dex file that you have copied into dex2jar folder in step 6.
- It will generate a appname.jar file into the same dex2jar folder.
- Now open jd-gui .zip and unzip it and click on jd-gui application.
- Now when the jd-gui opens browse the .jar that is generated in step 11 and you can browse the class file and source code.
Also if you dont like this steps then you can visit http://javadecompilers.com
Hope this post helps you.. please comment.