Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,151,987 members, 7,814,374 topics. Date: Wednesday, 01 May 2024 at 11:51 AM

Here Is How To Get The Source Code From Any APK File - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Here Is How To Get The Source Code From Any APK File (8073 Views)

39 Android Apps With Source Code For Beginners To Learn From & Make Their Own / Funny Source Code Comments / Convert Code From Php To Vb.net (2) (3) (4)

(1) (Reply) (Go Down)

Here Is How To Get The Source Code From Any APK File by naijatechworld: 7:20am On Jul 06, 2014
What is .apk file?
APK file is nothing but Android Package File(APK). APK is the file format used to distribute and install application software and middleware on Google's Android operating system.



Apk Files are Zip file formatted packages based on the JAR file format, with .apk extension. Apk files contains all program resources and code i.e it contains .dex files, resources, assets, certificates, and manifest file.



How to get source (java files) from .apk file?
As we now know that apk file is just a zip file containing all program resource file, we can now get java code from apk files with ease. Following are steps to get java code from apk files.
Step 1:Renaming .apk file

Rename the .apk file with the extension .zip (for example let the file be "demofile.apk" then after renaming it becomes "demofile.apk.zip"wink

Step 2:Getting java files from apk

Now extract the renamed zip file in specific folder, for example let that folder be "demofolder".
Now Download dex2jar from the link for windows and extract that zip file in folder "demofolder".
Now open command prompt and go to the folder created in previous step and type the command "dex2jar classes.dex" and press enter.This will generate "classes.dex.dex2jar" file in the same folder.
Now Download java decompiler from the link and extract it and start(double click) jd-gui.exe
From jd-gui window browse the generated "classes.dex.dex2jar" file in demofolder, this will give all the class files by src name.
Now from the File menu select "save all sources" this will generate a zip file named "classes_dex2jar.src.zip" consisting of all packages and java files.
Extract that zip file (classes_dex2jar.src.zip) and you will get all java files of the application.
Above steps will generate java files but to get xml files perform following steps.

Step 3:Getting xml files from apk

Download apktool and apktool install from the link and extract both files and place it in the same folder (for example "demoxmlfolder"wink.
Place the .apk file in same folder (i.e demoxmlfolder)
Now open command prompt and goto the directory where apktool is stored (here "demoxmlfolder"wink and type the command "apktool if framework-res.apk"
Above command should result in "Framework installed ..."
Now in command prompt type the command "apktool d filename.apk" (where filename is name of apk file)
This will generate a folder of name filename in current directory (here demoxmlfolder) where all xml files would be stored in res\layout folder.

http://comptech-blogger..com/2012/09/how-to-get-source-code-from-apk-file.html

Re: Here Is How To Get The Source Code From Any APK File by Nobody: 6:28pm On Jul 06, 2014
Hmmm! This is my work, what I researched myself, how did you copy it? Wow!!!

https://www.youtube.com/watch?v=bZKx9rH4sE4&ctp=CAkQpDAYAyITCNDp--Wasb8CFViQfgodTAYAaFIgZGVjb21waWxlIGFueSBhcGsgZmlsZSB0byBzb3VyY2U%3D&client=mv-google&guid=&hl=en-GB&gl=NG
Re: Here Is How To Get The Source Code From Any APK File by ayodinho91: 4:54pm On Jul 24, 2014
nice one
Re: Here Is How To Get The Source Code From Any APK File by Nobody: 5:15pm On Jul 24, 2014
OP you are promoting someone else's blog, whereas I made this tutorial first. www.getavenue..com

(1) (Reply)

How Do I Convert .mdb Files To .exe Files / Programming With Arduino / Differences Between Testing And Debugging In Programming Of Software Application

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 15
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.