Thursday, December 7, 2017
How to View Source Code of an Android APK file Part 2
How to View Source Code of an Android APK file Part 2

when you reverse do reverse engineering for the first time, it will be lil difficult, later its just a min of wrk. so dont skip any step, finish every step before you go to next one. Tanx for bearing with me. Lets go to the real post. :)
Every one who is reading this post is damn fckg intelligent, but every author has his own way of telling, so go step by step.
Step : 1 Download APK Tool (all OS) & "apk-install-windows" if you are using windows from Android-APKTool
Extract the two files in the same folder (APKTool) you should have the files like this
APKTool
|- aapt.exe
|- apktool.bat
|- apktool.jar
Step : 2 Download Dex-to-Jar Extract it.
mirror : Dex-to-Jar
Step : 2a Download JD-GUI written by Emmanuel Dupuy
mirror : JD-GUI
Step 3 : Download Android ADB
Step 4 : Connect your Mobile to PC with USB Debugging Enabled. How to Enable USB Debugging???
Step 5 : Open unzipped ADB folder, Press Shift + Right Click, anywhere in the folder. --> Select "Open Command Window here"

Step 6 : type
adb devices

You should see your device id. If you dont see some random letters, plz check whether you have connected properly.
Step 7 : type
adb pull system/framework/framework-res.apk

Step 8 :Copy the pulled framework files to APKTool Folder
If you have any issues pulling files, you can use my files >> framework.zip
Step 9 : Now, you should have the following in your APKTool folder

APKTool
|- aapt.exe
|- apktool.bat
|- apktool.jar
|- framework.jar
|- framework-res.apk
Step - 10 : (This Step is one time Process only, you need not do this again & again)
Change your directory to APKTool in Command Line
type
apktool if framework-res.apk
You might get an error
Exception in thread "main" brut.androlib.AndrolibException: Cant create directory
: C:UsersVeeVeeapktoolframework
at brut.androlib.res.AndrolibResources.getFrameworkDir(AndrolibResources.j
ava:663)
at brut.androlib.res.AndrolibResources.installFramework(AndrolibResources.
java:558)
at brut.androlib.Androlib.installFramework(Androlib.java:497)
at brut.apktool.Main.cmdInstallFramework(Main.java:228)
at brut.apktool.Main.main(Main.java:76)
Go to C:Users<username>
Create New Folder Named "apktool" and inside apktool create new folder named "framework"
re-type :
apktool if framework-res.apk
Success if you get this message
I: Framework installed to: C:UsersVeeVeeapktoolframework1.apk
(This Step is one time Process only, you need not do this again & again)
Till now we were preparing for gathering reverse engineering apk tools
Lets start Ripping APK,
Copy any *.apk to APK tool folder.
Consider the apk name is "Sample.apk"
Step 11:
type :
apktool d -s -f Sample.apk
d --> Decompile
-s --> only xml
-f --> Force delete folder if already exists.

Step : 12
Open Sample Folder, Copy "classes.dex" to Dex2Jar folder,
Step : 12a
Type :
d2j-dex2jar.bat classes.dex
Step : 12b
Type :
ren classes_dex2jar.jar src_class.zip
Feeling Tough, Copy these files into "dex2jar" folder & just double click, skip 12a & 12b EVERYTIME :)
You will find src_class.zip file, copy src_class.zip back to SampleFolder in APKTool.

UnZip src.zip to src
Open any file, i.e *.class inside src folder using JD-GUI
File --> Save All Sources --> src.zip
File --> Exit.
Delete Old classes.dex & src folder.
Unzip src.zip to src
This is only for Educational Purpose. Respect Developers & their work.