top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to extract code of apk file?

0 votes
448 views

Is there a way to get the source code from an APK file?

posted Jul 22, 2014 by Manav

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+2 votes
 
Best answer

Please follow below steps to get source file:

Step 1. Rename the .apk file to .zip file.
Step 2. Download dex2jar and extract that zip file to another folder.
Step 3. 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.
Step 4. 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.
Step 5. 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 1:Getting xml files from apk
Step 2. Download apktool and apktool install from the link and extract both files and place it in the same folder (for example "demoxmlfolder").
Place the .apk file in same folder (i.e demoxmlfolder)
Step 3. Now open command prompt and goto the directory where apktool is stored (here "demoxmlfolder") 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 file name in current directory (here demoxmlfolder) where all xml files would be stored in res\layout folder.

answer Jul 23, 2014 by Amit Kumar Pandey
Similar Questions
+1 vote

I am back-porting camera2 legacy implementation to older platforms and want to ship android.util.Size inside the apk. I assume newer systems will simplify ignore these but am not sure such behavior is part of the public API.

+3 votes

I designed a new file system and mounted it to a self created folder at /sdcard/mytest/. Now I want to check the Android Apps performance on this new file system.So I need to install some apk file to this folder, /sdcard/mytest/, not /sdcard/

Is there any way to install the apk using some command lines and designate the installation location?

+3 votes

I have installed apk from playstore but not able to update as I am not able to click next button though I can click cancel button.
This problem is in 2 inch android smart watch.

Same app when removed and install afresh, then next button becomes INSTALL button and it works in 2 inch smart watch. However I observed that same app install or update works fine in my smartphone with NEXT button and no problem.
The only difference is in more Google text for upgrade scenario, that is

Do you want to install an UPDATE to the existing application?
Your existing data will not be lost.
The update application will get access to:


1 click 5 alert in 3 emergency situation 
EasyM2M 3-in-1 EasySoS APP
https://play.google.com/store/apps/details?id=in.easym2m.sos
0 votes

I'm new to React Native. I'm running the app by using a real device. If I want to download apk file for other devices how can I generate? Please suggest.

+1 vote

My ultimate goal is to create a new lock screen for android so I thought that the best way to do that is to modify the source files that already implement the lock screens in android and particularly in android 4.2 or 4.3. I followed the instructions in http://source.android.com/source/building.html and i successfully downloaded and built android 4.3 in my computer. The next step is the modification of some java files. I want to do this with eclipse. I have eclipse 4.3.1 and I am trying to follow the instructions in http://source.android.com/source/using-eclipse.html . The problem is that the instructions are for older version of eclipse and with the new version i cant follow the 5th step as shown below :

  • If Eclipse asks you for a workspace location, choose the default.
  • If you have a "Welcome" screen, close it to reveal the Java perspective.
  • File > New > Java Project
  • Pick a project name, "android" or anything you like.
  • SELECT "CREATE PROJECT FROM EXISTING SOURCE", ENTER THE PATH TO YOUR ANDROID ROOT DIRECTORY, AND CLICK FINISH.
  • Wait while it sets up the project. (You'll see a subtle progress meter in the lower right corner.)

How can I do this correctly in eclipse 4.3.1 ; If i follow the wright steps will I be able to import all android 4.3 in eclipse without showing any errors? Please help me.

...