5,600,483 Members 32,743 Now Online
XDA Developers Android and Mobile Development Forum

[GUIDE] How to use APKTOOL

Tip us?
 
anasdcool71
Old
(Last edited by kinfauns; 15th April 2013 at 04:46 PM.)
#1  
anasdcool71's Avatar
Senior Member - OP
Thanks Meter 458
Posts: 1,266
Join Date: Apr 2012
Location: Jamshedpur
Arrow [GUIDE] How to use APKTOOL

I've seen many users inquiring about how to decompile apps. Although there are many threads on this, still users don't search. So i decided to create this guide as our GT-S5360 forum didn't have one. I learnt this from v6ser's tut about 5-6 months ago, so i would like to thank him before starting this guide. Please PM me guys if I've missed something or written something wrong!

What is decompiling?
Android apps are BASICALLY made up of Java codes and XML files. After compiling the app, these files cannot be viewed. Decompiling is a process which decompiles the binary form of XMLs and .Java files into readable form. The XML files can be retained as it is, but the .java files are converted into smali files, a totally different language.

What is recompiling?
Recompiling is simply a way to convert the XML and smali files back into the binary form and building up of the APK with the changes made. All apps after recompiled have to be signed (except system apps).

Let's start!

Things needed :-
JRE (Java Runtime Environment)
Windows - Download apktool
Download apktool-install-windows
Place both apktool files in C:\Windows\"HERE"

First off, you need to install the framework.
The three apks needed :-
framework-res.apk (location : /system/framework)
SystemUI.apk (location : /system/app)
twframework-res.apk (location : /system/framework)

Go to Command Prompt, and type :-
Code:
apktool if {framework's folder/location}
Example in the image here :-


Repeat the same step for SystemUI.apk and twframework-res.apk too, besides framework-res.apk
These will be saved here - C:\Users\your_user_name\apktool\"HERE"

Next step, is the decompiling.
Code:
apktool d C:\filename.apk C:\folder_of_the_decompiled_files
Example in the image here :-


Now, you can view the XML and smali files. I would recommend Notepad++ to edit them.
After making your changes, you're gonna need to recompile so that the files are again in the apk form.

Next step, recompiling.
Code:
apktool b C:\folder_of_the_decompiled_files C:\newfilename.apk
(You can use other directories too, I've just used C:\ as an example)
Example in the image here :-


Now, final step is signing the apk file.
Remember don't sign the apk if it's a SYSTEM app, unless you have edited the AndroidManifest.xml.

Signing.
Download the zip file here :- http://www.mediafire.com/?gs6n10oh09c039n
Extract the files in a folder named "SignApk", in any convienient location. (I preferred C:\)

Example of the code in image here :-


That's it! I hope this guide helps a lot of newbies and other users out there!
The Following 129 Users Say Thank You to anasdcool71 For This Useful Post: [ Click to Expand ]
 
InfinityShooter
Old
#2  
Recognized Contributor
Thanks Meter 4646
Posts: 5,452
Join Date: Jan 2012
Location: New Delhi
Reserved. why use it when you have apk manager and VTS?
The Following 4 Users Say Thank You to InfinityShooter For This Useful Post: [ Click to Expand ]
 
anasdcool71
Old
#3  
anasdcool71's Avatar
Senior Member - OP
Thanks Meter 458
Posts: 1,266
Join Date: Apr 2012
Location: Jamshedpur
Quote:
Originally Posted by hell_lock View Post
Reserved. why use it when you have apk manager and VTS?
I and many other users prefer it a for being simple. Apk manager and others can cause a lot of trouble when you don't have adb, or anything else.
The Following 3 Users Say Thank You to anasdcool71 For This Useful Post: [ Click to Expand ]
 
-CALIBAN666-
Old
#4  
-CALIBAN666-'s Avatar
Recognized Contributor
Thanks Meter 2798
Posts: 5,020
Join Date: Feb 2012
Location: Leverkusen
One of the usefullest threads i hope many newbies read this for understand.thumps up and up and up.....

MANY GREEEEETZ!!!
The Following User Says Thank You to -CALIBAN666- For This Useful Post: [ Click to Expand ]
 
manoranjan2050
Old
#5  
manoranjan2050's Avatar
Senior Member
Thanks Meter 1326
Posts: 1,073
Join Date: Dec 2011
Location: JAGATSINGHPUR

 
DONATE TO ME
Very nice thread..... Really helpful for all new user........

Sent from my GT-S6102 using Tapatalk 2
The Following User Says Thank You to manoranjan2050 For This Useful Post: [ Click to Expand ]
 
anasdcool71
Old
#6  
anasdcool71's Avatar
Senior Member - OP
Thanks Meter 458
Posts: 1,266
Join Date: Apr 2012
Location: Jamshedpur
Glad you guys liked it.

Sent from my GT-S5360 using Tapatalk 2
The Following User Says Thank You to anasdcool71 For This Useful Post: [ Click to Expand ]
 
hitme987
Old
#7  
hitme987's Avatar
Senior Member
Thanks Meter 329
Posts: 1,076
Join Date: Feb 2012
Could be useful for newbies, a detailed tutorial is hard to get, good work
The Following User Says Thank You to hitme987 For This Useful Post: [ Click to Expand ]
 
RivaultUser
Old
#8  
RivaultUser's Avatar
Senior Member
Thanks Meter 17
Posts: 298
Join Date: Jun 2012
Thx a lot for the tutorial mate! It's really helpful!

1 question! : If I want to edit the framework( I get it from another mod, so it's not my stock framework). Do I need to install the framework every time I want to mod a framework that I just get?


Thx a lot man!



I'm a newbieee
 
sunitcek
Old
#9  
Member
Thanks Meter 8
Posts: 84
Join Date: Sep 2012
good thread
 
anasdcool71
Old
#10  
anasdcool71's Avatar
Senior Member - OP
Thanks Meter 458
Posts: 1,266
Join Date: Apr 2012
Location: Jamshedpur
Quote:
Originally Posted by RivaultUser View Post
Thx a lot for the tutorial mate! It's really helpful!

1 question! : If I want to edit the framework( I get it from another mod, so it's not my stock framework). Do I need to install the framework every time I want to mod a framework that I just get?


Thx a lot man!



I'm a newbieee
No need...i mod many roms' frameworks but the installed one in apktool is repencis framework....btw, it would be better if you do it...

You can always press the thanks button if you wanna thank me!

Sent from my GT-S5360 using xda premium

The Following 3 Users Say Thank You to anasdcool71 For This Useful Post: [ Click to Expand ]
Tags
apk, apktool, compile, decompile, how to
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes