• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!
  • Fill out your device list and let everyone know which phones you have!    Edit Your Device Inventory

[GUIDE] How to use APKTOOL

Search This thread

anasdcool71

Senior Member
Apr 21, 2012
1,270
486
24
Jamshedpur
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 :-
image.png


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 :-
image.png


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 :-
image.png


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 :-
sign.png


That's it! I hope this guide helps a lot of newbies and other users out there!:D
 
Last edited by a moderator:

RivaultUser

Senior Member
Jun 30, 2012
302
18
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:fingers-crossed::fingers-crossed::fingers-crossed:
 

anasdcool71

Senior Member
Apr 21, 2012
1,270
486
24
Jamshedpur
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:fingers-crossed::fingers-crossed::fingers-crossed:

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
 

RivaultUser

Senior Member
Jun 30, 2012
302
18
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

Okay mate, can you help me solve this problem I had?
When I tried to recompile back my mod framework-res.apk I got this message :

C:\APKTOOL>apktool b testframework-res
W: Could not find sources
I: Checking whether resources has changed...
I: Building apk file...



What could not find resources means?


Thx for your help!
 

anasdcool71

Senior Member
Apr 21, 2012
1,270
486
24
Jamshedpur
Okay mate, can you help me solve this problem I had?
When I tried to recompile back my mod framework-res.apk I got this message :

C:\APKTOOL>apktool b testframework-res
W: Could not find sources
I: Checking whether resources has changed...
I: Building apk file...



What could not find resources means?


Thx for your help!

A framework-res.apk is itself the source of other apks( when you install it - apktool if...). So the message that you got is normal.

Sent from my GT-S5360 using xda premium
 

RivaultUser

Senior Member
Jun 30, 2012
302
18
A framework-res.apk is itself the source of other apks( when you install it - apktool if...). So the message that you got is normal.

Sent from my GT-S5360 using xda premium

I see, sorry for asking a lot of question........

Is this normal? :
ry_27.png
S: Could not decode file, replacing by FALSE value: drawable-hdpi/stat_sys_batte
ry_17.png
S: Could not decode file, replacing by FALSE value: drawable-hdpi/stat_sys_batte
ry_23.png
........... a lot more
I: Decoding values*/* XMLs...
I: Done.
I: Copying assets and libs...

This is happened when I try to decompile the framework-res.apk



Thx a lot man!!!!!



I'm a newbieee:fingers-crossed::fingers-crossed::fingers-crossed:
 

anasdcool71

Senior Member
Apr 21, 2012
1,270
486
24
Jamshedpur
I see, sorry for asking a lot of question........

Is this normal? :
ry_27.png
S: Could not decode file, replacing by FALSE value: drawable-hdpi/stat_sys_batte
ry_17.png
S: Could not decode file, replacing by FALSE value: drawable-hdpi/stat_sys_batte
ry_23.png
........... a lot more
I: Decoding values*/* XMLs...
I: Done.
I: Copying assets and libs...

This is happened when I try to decompile the framework-res.apk



Thx a lot man!!!!!



I'm a newbieee:fingers-crossed::fingers-crossed::fingers-crossed:

I never got that kind of message while decompiling. So i really can't tell. But unless you get no problems while recompiling, everything's good.:)

Sent from my GT-S5360 using xda premium
 
  • Like
Reactions: RivaultUser

RivaultUser

Senior Member
Jun 30, 2012
302
18
I never got that kind of message while decompiling. So i really can't tell. But unless you get no problems while recompiling, everything's good.:)

Sent from my GT-S5360 using xda premium

The thing is....... I also got problem in recompiling it :
C:\APKTOOL\framework-res\res\values\public.xml:4159: error: Public symbol drawab
le/stat_sys_signal_1_cdma declared here is not defined.
C:\APKTOOL\framework-res\res\values\public.xml:4160: error: Public symbol drawab
le/stat_sys_signal_2_cdma declared here is not defined.
C:\APKTOOL\framework-res\res\values\public.xml:4161: error: Public symbol drawab
le/stat_sys_signal_3_cdma declared here is not defined.
C:\APKTOOL\framework-res\res\values\public.xml:4162: error: Public symbol drawab
le/stat_sys_signal_4_cdma declared here is not defined.
C:\APKTOOL\framework-res\res\values\public.xml:4163: error: Public symbol drawab
le/stat_sys_signal_evdo_0 declared here is not defined.

and a lot more.....

And after I checked back the folder that I want to recompile, I dont find any disc folder there............

Any advice??????????

:crying::crying:
 

anasdcool71

Senior Member
Apr 21, 2012
1,270
486
24
Jamshedpur
The thing is....... I also got problem in recompiling it :
C:\APKTOOL\framework-res\res\values\public.xml:4159: error: Public symbol drawab
le/stat_sys_signal_1_cdma declared here is not defined.
C:\APKTOOL\framework-res\res\values\public.xml:4160: error: Public symbol drawab
le/stat_sys_signal_2_cdma declared here is not defined.
C:\APKTOOL\framework-res\res\values\public.xml:4161: error: Public symbol drawab
le/stat_sys_signal_3_cdma declared here is not defined.
C:\APKTOOL\framework-res\res\values\public.xml:4162: error: Public symbol drawab
le/stat_sys_signal_4_cdma declared here is not defined.
C:\APKTOOL\framework-res\res\values\public.xml:4163: error: Public symbol drawab
le/stat_sys_signal_evdo_0 declared here is not defined.

and a lot more.....

And after I checked back the folder that I want to recompile, I dont find any disc folder there............

Any advice??????????

:crying::crying:

Most probably, the changes that you made are not correct. That's why you got a problem while recompiling.
If you did no changes after decompiling, but still got a problem with recompiling, then try installing the framework-res.apk, SystemUI.apk and twframework-res.apk again and then try.
 
  • Like
Reactions: RivaultUser

hell_lock

Inactive Recognized Developer
Jan 20, 2012
5,972
5,173
24
New Delhi
The thing is....... I also got problem in recompiling it :
C:\APKTOOL\framework-res\res\values\public.xml:4159: error: Public symbol drawab
le/stat_sys_signal_1_cdma declared here is not defined.
C:\APKTOOL\framework-res\res\values\public.xml:4160: error: Public symbol drawab
le/stat_sys_signal_2_cdma declared here is not defined.
C:\APKTOOL\framework-res\res\values\public.xml:4161: error: Public symbol drawab
le/stat_sys_signal_3_cdma declared here is not defined.
C:\APKTOOL\framework-res\res\values\public.xml:4162: error: Public symbol drawab
le/stat_sys_signal_4_cdma declared here is not defined.
C:\APKTOOL\framework-res\res\values\public.xml:4163: error: Public symbol drawab
le/stat_sys_signal_evdo_0 declared here is not defined.

and a lot more.....

And after I checked back the folder that I want to recompile, I dont find any disc folder there............

Any advice??????????

:crying::crying:

Most probably, the changes that you made are not correct. That's why you got a problem while recompiling.
If you did no changes after decompiling, but still got a problem with recompiling, then try installing the framework-res.apk, SystemUI.apk and twframework-res.apk again and then try.

I have seen that problem alot of times... post the complete log here... its not a prob in public.xml
 
  • Like
Reactions: RivaultUser

RivaultUser

Senior Member
Jun 30, 2012
302
18
Most probably, the changes that you made are not correct. That's why you got a problem while recompiling.
If you did no changes after decompiling, but still got a problem with recompiling, then try installing the framework-res.apk, SystemUI.apk and twframework-res.apk again and then try.

About that, I shall install the systemUI.apk that I'm running on or the stock one?

I don't find any twframework-res.apk on my system/framework????????
 

Top Liked Posts

  • There are no posts matching your filters.
  • 158
    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 :-
    image.png


    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 :-
    image.png


    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 :-
    image.png


    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 :-
    sign.png


    That's it! I hope this guide helps a lot of newbies and other users out there!:D
    5
    Reserved. why use it when you have apk manager and VTS?
    5
    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:fingers-crossed::fingers-crossed::fingers-crossed:

    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
    2
    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.
    2
    Very nice thread..... Really helpful for all new user........

    Sent from my GT-S6102 using Tapatalk 2