Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

[GUIDE] How to use APKTOOL

OP anasdcool71

17th September 2012, 07:12 PM   |  #1  
anasdcool71's Avatar
OP Senior Member
Flag Jamshedpur
Thanks Meter: 477
 
1,265 posts
Join Date:Joined: Apr 2012
More
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!
Last edited by kinfauns; 15th April 2013 at 05:46 PM.
The Following 146 Users Say Thank You to anasdcool71 For This Useful Post: [ View ]
17th September 2012, 07:14 PM   |  #2  
Recognized Developer / Recognized Contributor
Flag New Delhi
Thanks Meter: 5,044
 
5,730 posts
Join Date:Joined: Jan 2012
Donate to Me
More
Reserved. why use it when you have apk manager and VTS?
The Following 5 Users Say Thank You to InfinityShooter For This Useful Post: [ View ]
17th September 2012, 07:17 PM   |  #3  
anasdcool71's Avatar
OP Senior Member
Flag Jamshedpur
Thanks Meter: 477
 
1,265 posts
Join Date:Joined: Apr 2012
More
Quote:
Originally Posted by hell_lock

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: [ View ]
17th September 2012, 07:23 PM   |  #4  
-CALIBAN666-'s Avatar
Recognized Contributor
Flag Leverkusen
Thanks Meter: 3,589
 
5,797 posts
Join Date:Joined: Feb 2012
Donate to Me
More
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: [ View ]
18th September 2012, 08:37 AM   |  #5  
manoranjan2050's Avatar
Senior Member
Flag JAGATSINGHPUR
Thanks Meter: 1,368
 
1,080 posts
Join Date:Joined: Dec 2011
Donate to Me
More
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: [ View ]
18th September 2012, 01:19 PM   |  #6  
anasdcool71's Avatar
OP Senior Member
Flag Jamshedpur
Thanks Meter: 477
 
1,265 posts
Join Date:Joined: Apr 2012
More
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: [ View ]
19th September 2012, 01:18 PM   |  #7  
hitme987's Avatar
Senior Member
Thanks Meter: 333
 
1,088 posts
Join Date:Joined: Feb 2012
More
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: [ View ]
21st September 2012, 10:01 AM   |  #8  
RivaultUser's Avatar
Senior Member
Thanks Meter: 18
 
300 posts
Join Date:Joined: Jun 2012
Question
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
21st September 2012, 10:37 AM   |  #9  
Member
Thanks Meter: 8
 
84 posts
Join Date:Joined: Sep 2012
good thread
21st September 2012, 11:03 AM   |  #10  
anasdcool71's Avatar
OP Senior Member
Flag Jamshedpur
Thanks Meter: 477
 
1,265 posts
Join Date:Joined: Apr 2012
More
Quote:
Originally Posted by RivaultUser

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: [ View ]
Post Reply Subscribe to Thread

Tags
apk, apktool, compile, decompile, how to
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes