Am writing few words about viewing source code of an android app, to
make sure this post appears in Google Search when you search for how to view source code of android apk or view source of apk, view android apk code and
purely for nothing else, i am gonna add few more random keywords to make more visibility on android view source code of android apk, Google does not understand grammar, but searches for important keywords such as android, source code, java decompiler, axml printer, JDGUI, smali, which is related to this post, you are here cox i added these words,
when you reverse do reverse engineering for the first time, it will be lil difficult, later it's just a min of wrk. so don't 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: Can't create directory
: C:\Users\VeeVee\apktool\framework
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:\Users\VeeVee\apktool\framework\1.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
Let's 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.