• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Root DIY: How To Decompile An Apk

niteNarmor

Android Expert
Jun 28, 2012
797
241
Jacksonville, NC
Decided to make this thread for people like me who do not know how to decompile an apk. This is totally a step by step guide. Following this exactly will produce the results you were looking for. This is how I changed the system background thanks to katracho for the instructions after you decompiled the apk:
Code:
[U][I][COLOR=red]PLEASE FOLLOW THE STEPS EXACTLY: I AM NOT RESPONSIBLE FOR
UNDESIRED RESULTS OR YOU MAKING YOUR PHONE INTO A DOOR
STOP.[/COLOR][/I][/U]
Again, this is how I did it:

First you need 4 things.
  1. Latest Java installed -> Java
    Make sure if you are using a 64 bit Windows 7 OS that you install the same version for JAVA.
  2. Download Apk Manager - Link ->Apk Manager
  3. Download Apk Tools - Link ->Apk Tools
  4. Download Apk Tools Installer - Link ->Apk Tools Installer
Once files are downloaded:
  1. Open the C:\ directory on your computer and make a folder called apk_manager
  2. Extract Apk Manger to that folder.
  3. Open apk_manager folder. Inside you will find a folder called "other". Take note of that.
  4. Extract Apk Tools to "other" in apk_manager folder
  5. Extract Apk Installer to same.
As you do step 4 and 5 it will ask when you move the files into folder if you want to replace existing files, choose Yes. (Thank you Ralkkai as I forgot about that).

You need to set a path for ADB so the computer can modify the path statement that will enable an MS-DOS window opened in Microsoft Windows as well as older programs to locate files that may be required to run the program.
  1. Navigate to My Computer
  2. Right click
  3. Properties
  4. Advanced System Settings
  5. Advanced
  6. Environment Variables
  7. System variables
  8. Scroll down and highlight Path
  9. Edit
  10. Type C:\AndroidSDK\tools;C:\AndroidSDK\platform-tools
  11. Click OK 3 times to exit
There has been a few issues with Java not being recognized on some computers. Below are the steps that should be taken to ensure Java is recognized:

1. Make sure Java is installed:

2. Open Environment Variables.
The first thing you should see when you open the environment variable screen on your computer is 2 boxes.
1. User variables for (insert your computer name here)
2. System variables.​
3. Go to User variables for (computer name)

4. Hit new.
Next you should see a screen pop up saying New User Variable
Variable name:
Variable value:​
In Variable Name:
6. Type: Classpath

In Variable value:
7. Type: ".;C:\Program Files (x86)\Java\jre6\lib\ext\QTJava.zip;C:\Program Files (x86)\Java\jre7\lib\ext\QTJava.zip;" WITHOUT QUOTES

Next do the EXACT same thing in System variables.
If you scroll down in System variable you should see JAVA_HOME.​
If not hit new:
Pop up screen will appear.​
In Variable name

8. Type: JAVA_HOME (in caps)

In Variable value

9. Type: C:\Program Files\Java\jdk1.6.0_27;%JAVA_HOME%\bin

You should also see (if you scroll down further) QTJAVA. If not;​
10. Hit new

In Variable Name

11. Type: QTJAVA

In Variable value :

12. Type: C:\Program Files (x86)\Java\jre7\lib\ext\QTJava.zip

That should solve all the path issues.​


Now time for the fun stuff:
  1. Plug phone into computer.
  2. Open the apk_manager folder and find a file called Script. Double click to run.
    Again, this is how to decompile an apk. Will also show how to recompile in this post.
  3. Read through ALL the options apk_manager provides. Then read them again.
  4. Type 0 for adb pull. (This option will actually pull the file from where ever it is on phone).
  5. Once you selected that option, you will see:
    Where do you want adb to pull the apk from?
    Example of input : /system/app/launcher.apk
    Type input:​
    YOU HAVE TO KNOW EXACTLY WHAT FILE AND WHERE THE FILE IS LOCATED AT!!!!
  6. Once selected you will see:
    Pulling apk
    What filename would you like this app to stored as ?
    Eg (launcher.apk)
    Type input:​
  7. Name the file whatever you want. I would suggest the same name it already has.
  8. Next you will see:
    Would you like to set this as your current project (y/n)?
    Type input:​
  9. Type y then hit enter
    After that is done you will see the "Please make your decision:" line again.​
  10. Type 9 to Decompile apk (again, this is how I did it)
    You will see: Decompiling apk​

To view the file you just decompiled:
  1. Goto apk_manager on your C:\ directory
  2. Open apk_mananger
  3. Open "Projects" folder (no quotes). Inside you will find the file you just decompiled.
    To view the xml files you are modifying, you need to right click on the xml file and choose notepad. Also notepad++ works on just about any code available.

After you have modified the file and are ready to compile and finish your project:

  1. Type 11 to compile apk - You will see:
    Building Apk
    Is this a system apk (y/n)
    Type input:​
  2. For the sake of argument, this will be a system apk. Type y - hit enter
    You will see:

    Aside from the signatures, would you like to copy over any additional files that you didn't modify from the original apk in order to ensure least # of errors (y/n)
    Type input:​
  3. Type y - hit enter. (Again, this is what I did)
    You will see the program extracting then:

    Everything is OK
    Folders: (# of folders it made)
    Files: (# of files it extracted)
    Size: (size of the files)
    Compressed (size of compressed files)
    In the apk manager folder u'll find a keep folder. Within it, delete everything you have modified and leave files that you haven't. If you have modified any xml, then delete resources.arsc from that folder as well. Once done then press enter on this script.
    Press any key to continue...​
  4. Press any key to continue :)
    You will see the program compressing the files.​


And that is it. If you read all the selections in Apk Manager then you will see the selections for how to put the files back into you phone.

Sorry this is so long but I wanted to make sure that even people like me know exactly how to decompile apks.

Anything you want me to add or delete, please let me know.
 
ive been wanting to find something like this so i could poke around DSP Manager to see if i could find anything that could be done about the EQ not working on the TU. great work and thanks a ton! i might start hacking and cracking at it this weekend when i get the time.

DSP Manager? Is that the one that shows an EQ type screen when headphones are plugged in?
 
Upvote 0
the apk came from cyanogenmod. i know for starters that that is an issue. it was built around ics framework and whatnot i believe and im running it inside a gingerbread built rom. from what i read you shoudl be able to run it on any ics rom and alot of ppl say they got it working on gingerbread with some force close issue. im on my tablet right now so i cant link the website but xda has a thread on it. you should find it if you search for dsp manager zip or apk
 
Upvote 0
when i extract the second 2 zips to the "others" folder it pops up with a "do you want to replace this file" screen? i click yes right? basically same file?

EDIT: i dont know what im doing wrong but i have java and the SDK installed but its telling me that adb is not found. so i havent even gotten off the ground yet lol

Sorry was out of city in a dead zone.

Yes. Replace the two files. If you haven't done so.

My computer was acting weird too. I had Java installed but it was telling me it wasnt. Have you entered the path into the variable screen with adb?
 
Upvote 0
Sorry was out of city in a dead zone.

Yes. Replace the two files. If you haven't done so.

My computer was acting weird too. I had Java installed but it was telling me it wasnt. Have you entered the path into the variable screen with adb?


I haven't and that's probably where I'm getting hung up. Did u need to set a path for Java and the adb both or just the adb? And I was having an issue with having an old version of Java so once I got rid of the old and just had the new that part is working but I get stuck in cmd with it not recognizing the adb
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones