[Guide] How-To Properly Decompile and Recompile apk's with apktool


  1. LDrifta

    LDrifta No Stranger 2 Danger Guide

    How-To: Decompile/Recompile apk's with ApkTool

    ------------------------------------------------------------------------------------------------------------
    Requirements:

    ApkTool
    Java JDK/JRE 32 bit
    Basic Cmd/terminal knowledge

    ------------------------------------------------------------------------------------------------------------
    Download ApkTool here

    ApkTool.zip

    first you need to extract that zip folder to anywhere you choose, preferably on root of c/drive ie: C:/android/apktool extracting the files to 'apktool' folder

    Now place the STOCK framework-res.apk & whatever other apk's you would like to modify into the 'apktool' folder

    ------------------------------------------------------------------------------------------------------------
    Getting to CMD directory


    Open up a Cmd Prompt (terminal) and get to the 'apktool' directory ie:

    ------------------------------------------------------------------------------------------------------------
    Installing Framework

    Now that you are in directory we need to install the device's framework to your system for it to compile correctly so type this:

    apktool if framework-res.apk

    this will install the devices framework to your system (need to do this)

    ------------------------------------------------------------------------------------------------------------
    Decompiling

    now to decompile the apk you want to edit.. type this:

    apktool d framework-res.apk framework1

    or

    apktool d music.apk music

    music.apk is the apk your decompiling
    music is the folder you're creating for the decompiled apk

    now make your edits :D DO NOT Change/Edit ANY PNG's

    ------------------------------------------------------------------------------------------------------------
    Recompiling/Finished Product

    now to recompile your new apk type this:

    apktool b music music-new.apk

    or

    apktool b framework1 framework-res-new.apk

    framework1 is the folder with your edited files
    framework-res-new.apk is your new apk file :D

    Now we are NOT done... we cannot use the new apk's... we have to take what we did and add it back to the original apk file to keep proper signature :D

    use something like 7zip, take the 'resources.arcs' file and any other xml files you edited out of the "-new" apk and copy them into Original apk

    now the apk is ready to flash with your new changes :D :D
    ------------------------------------------------------------------------------------------------------------

    Hope this helped some of you new themers out there!!!

    Advertisement
    :
  2. gbiggie

    gbiggie La patience et le pardon Guide

    You GO BOI:p:D:cool:
    LDrifta likes this.
  3. ShinySide

    ShinySide Disabled

    I extracted to my desktop then moved adb and related files to the platform tools folder inside the apk manager file.

    And just a tip on to know if you did everything right is, when you run apk manager and the window pops up if a green android and "apk manager" does show in the first window when you start it up it wasn't set up right.
  4. LDrifta

    LDrifta No Stranger 2 Danger Guide

    this method is just for on the computer no adb required...
  5. LDrifta

    LDrifta No Stranger 2 Danger Guide

    Cleaned up the op a little
    gbiggie likes this.
  6. BRIAN5337

    BRIAN5337 Well-Known Member

    Ok..

    I must be missing something. :D

    Does the system framework .apk have to be downloaed from another location.
  7. LDrifta

    LDrifta No Stranger 2 Danger Guide

    what do you mean?
  8. HereticSins

    HereticSins Well-Known Member

    The system framework apk gets extracted from whatever ROM you want to theme or modify.
  9. BRIAN5337

    BRIAN5337 Well-Known Member

    Ok..
    If i understand correctly.
    Say i wanted to decompile any .apk to poke around the files.

    When i put the APKtool in the correct directories i then typed in command line the command calling on the apktool if framework-res.apk.

    It doesn't find it in the folder.So i downloaded framework-res.apk from another location and did command again,then it saw it and decompiled it.

    I'm sure already you can conclude i'm not really familiar with this. Any help will be useful
  10. LDrifta

    LDrifta No Stranger 2 Danger Guide

    lol you need to have the framework apk in same directory ask apktool.bat, apktool.jar and aapt.something.. lol
    your not installing it to your phone lol to your computers system :D

    EDIT: i apologize, let me explain a little further.. when decompiling an apk file, especially a system required apk such as settings, systemui, etc.. you NEED to install the framework resources before decompiling so it will properly recompile:D

    so you dont NEED to do it everytime, but you must do it the first time.. as long as it installs than you will be ok
  11. BRIAN5337

    BRIAN5337 Well-Known Member

    Ok i did that and its working now. Thanks

    Is there some sensitive parts of the .APK that might hender it?

    EDIT: Oh im glad i can bring you such laughter..with my questions. ha ha
    Thanks again
  12. LDrifta

    LDrifta No Stranger 2 Danger Guide

    what do you mean by that? ^^ Bold
  13. BRIAN5337

    BRIAN5337 Well-Known Member

    This may have a multi part answer.
    When you mess with parts of a ROM it causes the ROM to boot-loop at times?

    also some .APK ,If its a pay app parts of the registration file may cause it mess up?
  14. LDrifta

    LDrifta No Stranger 2 Danger Guide

    depends on wat yu edit.. lol important system files can cause a boot loop..
  15. BRIAN5337

    BRIAN5337 Well-Known Member

    I will have to find the time to learn where those files are located in each .APK and know what different changed can be done. Lol:D


    Thank you
  16. LDrifta

    LDrifta No Stranger 2 Danger Guide

    yeah there not really a way to learn that specific thing at one time.. it's kinda a leran as you go deal with each ind. apk lol some are harder to edit than others..
    BRIAN5337 likes this.
  17. chessplaya2010

    chessplaya2010 New Member

    i'm stuck at the end of this tutorial... i'm able to recompile my apk but... you said we can't use it because it was obviously signed... but whenever i copy the resources.arcs and manifest file into the 'original' apk... and then i try to reinstall it... i keep getting " INSTALL_PARSE_FAILED_NO_CERTIFICATES...

    please help... all i'm trying to do is this application i'm assessing has the debugging statement listed as 'false'... all i'm trying to do is
    1. decompile
    2. modify debbugable to TRUE
    3. recompile
    4. install and analyze the logcat

    HELP TIA
  18. LDrifta

    LDrifta No Stranger 2 Danger Guide

    what app are you trying to do this to? for what rom and what kernel do you have?
  19. Fuzzy13

    Fuzzy13 Well-Known Member

    Everytime I try to compile an APK I get an error.

    Im not doing it through ADB, Im running it all on my computer and editing them first and then pushing them to the phone. But I cant get an apk to work because I cant compile???
  20. LDrifta

    LDrifta No Stranger 2 Danger Guide

    what apk are you trying to edit? if it's non-stock than you will have issues lol you need to use stock apk, and ONLY edit xml files... DO NOT edit your png files when decompiling/recompiling!!!
  21. Fuzzy13

    Fuzzy13 Well-Known Member


    I started using AutoApktool and it's working a lot better. I like having the stand alone interface too. I wasn't using Apktool before, it was ApkEdit and that was the one that I couldn't compile with. I tried to compile with Tool and it worked fine but I liked having the interface from which I came across AutoApk and it's much easier. No commands and all that. :D
  22. pagenotfound

    pagenotfound New Member

    Is there a problem when it comes to decompling Phone.apk?

    Code (Text):
    1.  
    2. C:\apk>apktool if framework-res.apk
    3. I: Framework installed to: C:\Users\MM\apktool\framework\1.apk
    4.  
    5. C:\apk>apktool d Phone.apk
    6. I: Baksmaling...
    7. testI: Loading resource table...
    8. W: Skipping "android" package group
    9. I: Loaded.
    10. I: Loading resource table from file: C:\Users\MM\apktool\framework\1.apk
    11. I: Loaded.
    12. I: Decoding file-resources...
    13. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    14. background, value=0x02020350
    15. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    16. textSize, value=0x020b0021
    17. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    18. layout_height, value=0x020b00a0
    19. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    20. layout_width, value=0x020b008b
    21. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    22. layout_height, value=0x020b008a
    23. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    24. src, value=0x02020187
    25. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    26. textSize, value=0x020b0094
    27. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    28. background, value=0x02020350
    29. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    30. background, value=0x020204d6
    31. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    32. drawable, value=0x020200f8
    33. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    34. drawable, value=0x02020354
    35. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    36. textSize, value=0x020b0021
    37. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    38. background, value=0x0202003f
    39. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    40. text, value=0x020800ae
    41. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    42. text, value=0x02080172
    43. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    44. background, value=0x020202d4
    45. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    46. button, value=0x0202011c
    47. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    48. drawable, value=0x020204cf
    49. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    50. background, value=0x0201002b
    51. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    52. background, value=0x0202013f
    53. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    54. drawable, value=0x02020349
    55. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    56. drawable, value=0x0202034b
    57. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    58. drawable, value=0x0202034a
    59. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    60. drawable, value=0x020204cb
    61. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    62. drawable, value=0x020204cb
    63. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    64. layout_above, value=0x02090032
    65. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    66. layout_above, value=0x02090032
    67. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    68. background, value=0x02020114
    69. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    70. background, value=0x02020114
    71. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    72. background, value=0x02020114
    73. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    74. drawable, value=0x02020356
    75. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    76. drawable, value=0x02020354
    77. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    78. drawable, value=0x02020357
    79. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    80. drawable, value=0x02020357
    81. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    82. drawable, value=0x02020357
    83. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    84. drawable, value=0x02020355
    85. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    86. drawable, value=0x02020354
    87. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    88. drawable, value=0x02020356
    89. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    90. drawable, value=0x020204cb
    91. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    92. drawable, value=0x020204cc
    93. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    94. drawable, value=0x020204cd
    95. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    96. drawable, value=0x020204d4
    97. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    98. background, value=0x02020399
    99. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    100. background, value=0x020204d6
    101. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    102. textSize, value=0x020b00e0
    103. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    104. drawable, value=0x02020354
    105. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    106. drawable, value=0x020204cb
    107. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    108. drawable, value=0x020204cc
    109. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    110. drawable, value=0x020204cd
    111. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    112. src, value=0x020204d4
    113. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    114. background, value=0x02020399
    115. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    116. background, value=0x02020344
    117. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    118. layout_height, value=0x020b00a0
    119. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    120. layout_width, value=0x020b008b
    121. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    122. layout_height, value=0x020b008a
    123. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    124. src, value=0x02020187
    125. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    126. textColor, value=0x020a0026
    127. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    128. textSize, value=0x020b0094
    129. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    130. textColor, value=0x020a0036
    131. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    132. background, value=0x02020101
    133. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    134. divider, value=0x02020498
    135. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    136. background, value=0x020204ca
    137. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    138. textSize, value=0x020b00e4
    139. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    140. background, value=0x02020430
    141. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    142. layout_marginRight, value=0x020b00e5
    143. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    144. src, value=0x020204d0
    145. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    146. background, value=0x0202059a
    147. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    148. background, value=0x0202056a
    149. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    150. background, value=0x020205a1
    151. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    152. background, value=0x0202059f
    153. W: Could not decode attr value, using undecoded value instead: ns=android, name=
    154. background, value=0x02020569
    155. I: Decoding values*/* XMLs...
    156. Can't find framework resources for package of id: 2. You must install proper fra
    157. mework files, see project website for more info.
    158.  
  23. LDrifta

    LDrifta No Stranger 2 Danger Guide

    EDIT: which framework did you use? from stock rom or modded rom?
  24. Fuzzy13

    Fuzzy13 Well-Known Member

    Say you are editing in the values folder which turns into the resources file when compiled, and you make all your edits. Let's say you make some edits in the colors and public folder. You compile and transfer the resources over to your current fw and push it. Well you find that one of the edits in the colors folder isn't what you want.


    Since you must use the stock fw and not the one you just edited do you have redo all your edits even though you want to change just one thing? You go back to change your edits in the colors xml, you have to change everything right?

    If there an easier way to do this or am i doing it wrong?




    Editing xmls in the layout or drawables folder is easier because they don't compile into one file like the resources. You can just edit it and compile and drag the xml over to your fw and if it's not what you want then all you have to do is edit that one file.
  25. ShinySide

    ShinySide Disabled

    Someone help me with this stupid error. Its driving me insane. Ive downgrade and re-upgraded apktool, used different mms and framework-res', changed the ic_mms_drm_protected.png to 50 million things, deleted it, and even switched to Easy apk disassembler (which my the way uses apktool) and so on and can not get past this dumb error

Loading...

Share This Page