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

Search This thread

Powerhouse

Senior Member
Mar 31, 2013
797
2,019
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... :)

tbut.png

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 !!!)
capturejkkf.png


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

7fca.png



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.

91574699.png


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.

12533570.png



4) SETTING UP APK-TOOL :

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

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

khm6.jpg


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

fcdw.jpg

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

Code:
apktool if framework-res.apk

or

Code:
apktool if [I]name_of_apk_you_wanna_install[/I] .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 [I]name_of_app_you_wanna_decompile [/I].apk


cywe.jpg



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 ..


9ivq.jpg



e3eo.jpg



jawh.jpg



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[/CENTER]



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:

Top Liked Posts

  • There are no posts matching your filters.
  • 4
    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... :)

    tbut.png

    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 !!!)
    capturejkkf.png


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

    7fca.png



    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.

    91574699.png


    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.

    12533570.png



    4) SETTING UP APK-TOOL :

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

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

    khm6.jpg


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

    fcdw.jpg

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

    Code:
    apktool if framework-res.apk

    or

    Code:
    apktool if [I]name_of_apk_you_wanna_install[/I] .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 [I]name_of_app_you_wanna_decompile [/I].apk


    cywe.jpg



    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 ..


    9ivq.jpg



    e3eo.jpg



    jawh.jpg



    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[/CENTER]



    CREDITS ::

    brut.all
    iBotPeaches
    All the guys who supported me and whatsapp friends ..
    android-blog {learn it from 'em when i was new}
    3
    Please click me ..!! ;) :fingers-crossed:

    Dont forget to Rate the thread as 5stars :) and newsWorthy thread
    2
    reserved once again}
    1
    Nice explanation it is very helpful for Newbies :)