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

[TUTORIAL][HOW TO]Decompile,Recompile apps via APKTOOL{screenshot explanation]

OP Powerhouse

28th December 2013, 07:21 PM   |  #1  
Powerhouse's Avatar
OP Senior Member
Thanks Meter: 1,991
 
796 posts
Join Date:Joined: Mar 2013
HOW TO DE-COMPILE , RE-COMPILE USING "APKTOOL"

WHAT IS APK-TOOL :
ABOUT :
It is a tool for re-engineering 3rd party, closed, binary Android apps.

It can decode resources to nearly original form and rebuild them after making some modifications; it makes possible to debug smali code step by step.

Also it makes working with app easier because of project-like files structure and automation of some repetitive tasks like building apk, etc.
EXPLANATION :
Suppose you want to modify an App according to the way you want it to be ..!!! This can't be done without any Tool .. So @iBotPeaches introduced the legendary Tool "APK-TOOL" ... It is used to modify the apps ..!! De-odexed app's make the work more easier ..It can decode resources to nearly original form..It hepls us with many repetitive tasks ..
[/INDENT][/INDENT]



SETTING UP APK-TOOL :


1) Install Java JDK :-

Before installing the Android SDK, you’ll have to install Oracle’s Java development kit. You can download it from here...(click me !!)

Even if you already have the Java runtime (JRE) installed, you’ll need to install the JDK as well...


After installing Java JDK , you can now download the Android SDK from Google .

NOTE :- If you see a any type of Java-related error during installation, then download and install the x86 version of the JDK, not the x64 one ...



2) Install Android SDK :-

Download Android SDK from here...(click me !!!)


After clicking on "DOWNLOAD FOR OTHER PLATFORMS" , you will get an extended menu ..




After downloading the .exe file , then Double click on the .exe file and install it in C:\ Drive or on whichever drive you wanna install .



3) Android SDK Setup :

Once the Android SDK is downloaded and installed, launch the SDK Manager application from your Start menu.



Enable the Android SDK tools and SDK Platform-tools checkbox and click the Install button. This downloads and installs the platform-tools package, which contains ADB and other utilities.




4) SETTING UP APK-TOOL :

Download Apk-tool from here ...(click me ...!! )

Now extract the Tar file...Open the extracted Apk-tool Folder...



Now hold shift and right-click button ..Now select "open command prompt here" in the new extended menu ..


And now , you gotta install Framework-res.apk,system-UI.apk ..etc ..

Code:
apktool if framework-res.apk
or

Code:
apktool if name_of_apk_you_wanna_install .apk

Now lets decompile a .apk file ..

Here i will take Framework-res.apk as example ..

Code:
apktool d framework-res.apk
or

Code:
apktool d name_of_app_you_wanna_decompile .apk




After Modding the app it's time to re-compile the app ... Note that here you need not to enter the .apk extension as weel Just add the Decompiled folder name .. Like in my case the folder name is "framework-res"

Code:
apktool b framework-res
or
Code:
apktool b name_of _the_folder_of_app_you_decompiled
Now you can find your Modified new app in the 'dist" folder which is present in the De-compiled app Folder ..











Most important part is that you gotta sign your modified app .. In case of a system app there is no need . But if you modded any non-system app then signing the app is necessary or else the app won't install ..


SIGNING APP


Download this..{click me..!!}

Extract the .zip file and place the app which is to be signed in the folder..Now

Code:
java -jar signapk.jar certificate.pem key.pk8 path_of-folder-having-the-apkWhichIsToBeSigned .apk path-of-the-new-signed-apk.apk
eg ::
Code:
 java -jar signapk.jar certificate.pem key.pk8 c:/xda/apktool/system_unsigned.apk c:/xda/apktool/system_signed.apk

ZIPALIGNING THE APP

copy zipalign.exe from C:\Program Files\Android\android-sdk\tools

Open cmd and type this code

Code:
zipalign -fv 4 nameOfAppYouWantToZipalign.apk New_NameOfZipalignedApp.apk
eg :

Code:
zipalign -fv 4 framework-res.apk framework-new.apk



CREDITS ::

brut.all
iBotPeaches
All the guys who supported me and whatsapp friends ..
android-blog {learn it from 'em when i was new}
Last edited by Powerhouse; 16th January 2014 at 03:31 AM.
The Following 4 Users Say Thank You to Powerhouse For This Useful Post: [ View ]
28th December 2013, 07:22 PM   |  #2  
Powerhouse's Avatar
OP Senior Member
Thanks Meter: 1,991
 
796 posts
Join Date:Joined: Mar 2013
Please click me ..!!

Dont forget to Rate the thread as 5stars and newsWorthy thread
Last edited by Powerhouse; 28th December 2013 at 07:29 PM.
The Following 3 Users Say Thank You to Powerhouse For This Useful Post: [ View ]
28th December 2013, 07:23 PM   |  #3  
Powerhouse's Avatar
OP Senior Member
Thanks Meter: 1,991
 
796 posts
Join Date:Joined: Mar 2013
reserved once again}
The Following 2 Users Say Thank You to Powerhouse For This Useful Post: [ View ]
28th December 2013, 08:56 PM   |  #4  
iamareebjamal's Avatar
Recognized Contributor / Themer
Flag Batcave
Thanks Meter: 4,778
 
3,630 posts
Join Date:Joined: Aug 2012
More
(Just saying)

You don't require Android SDK for apktool
29th December 2013, 03:46 AM   |  #5  
Powerhouse's Avatar
OP Senior Member
Thanks Meter: 1,991
 
796 posts
Join Date:Joined: Mar 2013
Quote:
Originally Posted by iamareebjamal

(Just saying)

You don't require Android SDK for apktool

Ya ..There is no need of Android SDK for apktoool but the tools might be helpful for Logcat'ting and Pushing the files via ADB ..
29th December 2013, 06:07 AM   |  #6  
Hitesh2626's Avatar
Recognized Contributor
Flag ☆◢Mumbai◣☆
Thanks Meter: 1,429
 
1,813 posts
Join Date:Joined: Feb 2013
More
Nice explanation it is very helpful for Newbies
The Following User Says Thank You to Hitesh2626 For This Useful Post: [ View ]
16th March 2014, 01:38 AM   |  #7  
Nonta72's Avatar
Senior Member
Flag Gallifrey
Thanks Meter: 441
 
536 posts
Join Date:Joined: Mar 2013
More
Anyway to do this using Android Device itself ?








Sent from Gallifrey using TARDIS

The Following User Says Thank You to Nonta72 For This Useful Post: [ View ]
Post Reply Subscribe to Thread

Tags
how to decompile recompile using apk-tool, how to hack xda accounts xd 2, how to kill people xd, how to use apktool
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes