[Tutorial] Decompile/Recompile Apk with Apk Multitool + Decompile/Recompile Jar Files

Search This thread

Saqib Nazm

Retired Forum Moderator / Inactive Recognized Them
Oct 3, 2012
2,889
7,753
Virginia, USA

" This thread will cover various useful guides starting from how to Decompile/Recompile Apk & Jar files. Me & my friend Aneel will provide new guides/tutorial day by day so that you guys can get many handy guidance in one place. Please Suggest us If you need any guide & we will try to post it If we actually can. Also If you find our guides useful then support us my giving feedback, hitting thanks & adding in credits section "


1st Let's start with [How to decompile & recompile with Apk Multitool]:

*Requirements*

Steps

1. Unzip Apk Multi Tool into a folder
2. Now run Setup.bat. It will look like this

PRBujPT.png


3. Now choose 3. Setup Directories & press enter
4. This will create the folders needed. It will look like this

rhUHjOm.png


5. Now place the apk you want to decompile in place-apk-here-for-modding
6. Place a framework-res.apk, SemcGenericUxpRes.apk & SystemUI.apk in other folder. Preferebly it should be from the same package of apk/same apks of a Rom which you placed in the place-apk-here-for-modding folder. If there is no corresponding apks then you can try with other framework & systemUI apks also.
7. Now again run Setup.bat & press enter & choose 2. Installing Framework-Res. It will look like this

Enx1oXC.png


8. Now choose option 1 & enter to install framework & again option 4 & enter to install SystemUI
9. Now run Script.bat & press enter to activate various menu. Choose option 9 to decompile the apk. Then press enter. It will look like this

baj25eC.png


10. Once decompile is complete close the script & go to projects folder
11. Do the necessary changes you want to
12. When editing is done again run Script.bat
13. Choose option 11 to recompile & press enter. It will prompt a message after sometimes, Aside from the signatures....of errors (y/n)

H8bI14u.png


14. Input y & press enter
15. Now after sometimes, it will again ask you to delete everything you have modified from keep folder & also delete resources.arsc if you have modified any xml. Minimize the script, delete the xml(s) you have modified (other than from values folder, it won't appear in keep folder) & also resources.arsc. If you have modified any png (not added) then delete it too. Then press enter when you are ready.

ig324Ou.png


16. Now your new apk is ready. You can find it in place-apk-here-for-modding folder. Note that, your original apk will also be in the same folder with original name. Your modified apk will have System_ attached in the name.

17. Copy it to some other place & rename to original apk name & enjoy.
18. When you want to work on the next project then delete everything from place-apk-here-for-modding & projects folder. Now follow the same steps again from Number 5 of this guide.


[How to decompile & recompile Jar Files]:

*Requirements*

  • Winrar/7zip
  • Deodexed Jar files
  • smali.jar
  • baksmali.jar (both are in the attachment)
  • Command Prompt/Terminal
0. Take the classes.dex from jar file by opening it with 7zip/Winrar.
1. Open a new folder in Desktop named suppose "Jar"
2. Place smali.jar & baksmali.jar in the folder
2. Open Command Prompt. On windows type cmd in Run
3. cd to your directory where you have opened the new folder. In my case it is

Code:
C:\Documents and Settings\USER\Desktop\Jar
4. Write
Code:
cd C:\Documents and Settings\USER\Desktop\Jar
& press enter. Note that, on your case the directory will be different from mines. So get the correct directory by going into that directory from C:

YMMyBaX.jpg


5. Now type this to Decompile. Note that, there is a "space" before "classes.dex"


Code:
java -jar baksmali.jar -o classout\ classes.dex
& press enter

3d1H5mI.jpg


6. When Decompiling is done there will a folder named "classout" be placed in Jar folder. Minimize the cmd.

f6JIxBp.png


7. Now make the necessary changes inside the classout folder
8. When done,type this to recompile & press enter. Remember, there is a "space" before "new-classes.dex"


Code:
java -Xmx512M -jar smali.jar classout\ -o new-classes.dex


9. When recompiling is done there will be a new file in the folder named "new-classes.dex"

Lqrz6iD.png


10. Now rename new-classes.dex to classes.dex & put it in the jar file with 7zip/Winrar


..............That's All. Thank You.................


Credits:

  • @raziel23x for Apk Multitool
  • @iONEx for teaching me about Apk Multitool when I was a noob
  • @Hero for Decomping jar files concept
 

Attachments

  • APK-Multi-Tool-Stable-RELEASE.zip
    6.6 MB · Views: 27,867
  • baksmali.jar
    528.4 KB · Views: 4,244
  • smali.jar
    717.1 KB · Views: 3,967
Last edited:

vishal_android freak

Inactive Recognized Developer / Recognized Contrib
Dec 30, 2012
1,898
5,637
Mumbai
@saqib nazm, it would be good if you add tut on how to recompile apks after making changes in androidmanifest.xml.. Because I have observed it gives bootloops.. As signing of apps just puts meta inf and doesn't do anything to androidmanifest.. Just a suggestion.. ;)

Sent from my MT11i using xda premium
 

Saqib Nazm

Retired Forum Moderator / Inactive Recognized Them
Oct 3, 2012
2,889
7,753
Virginia, USA
Ive been into that place if you knew david guetta face in the thread thats me. Thanks for your kindness to redirect me. The OP is not just very much accommodating geez...

I suggested you to install the proper framework files to decompile miui stuffs properly, though this thread is for compiling & decompiling with apk multi tool,not how to center clock on miui I beg your pardon? & I didn't say anything else because sandy already directed you to a guide, that's probably I would also gonna do If I were in the 1st place like sandy replied. You cannot say words which can hurt other people. Cause If I would know how to "Center clock on miui" I would open a thread with that guide,isn't it?
 

Mazellat

Senior Member
Mar 25, 2012
1,739
1,319
30
Konya
First of all,Thank you for work but I have a lot of problems.Can you help me about thats? I did everything step by step.No problems with 1 to 6 steps.I placed the apk place-apk-here-for-modding and I placed a framework-res.apk, SemcGenericUxpRes.apk & SystemUI.apk in other folder.

2mhfuc5.jpg


2nbrslg.jpg


After that,in step 7&8,when I choose option 1 & enter to install framework & again option 4 & enter to install SystemUI,I get this screens

aoat83.jpg


vghgfl.jpg


So,in step 9,Run Script.bat & press enter to activate various menü choose option 9 to decompile the apk. Then press enter,I get errors like this

2qb80si.jpg


1zofazb.jpg


And so,projects folder is empty.What is the problem and what can I do?
 

Saqib Nazm

Retired Forum Moderator / Inactive Recognized Them
Oct 3, 2012
2,889
7,753
Virginia, USA
First of all,Thank you for work but I have a lot of problems.Can you help me about thats? I did everything step by step.No problems with 1 to 6 steps.I placed the apk place-apk-here-for-modding and I placed a framework-res.apk, SemcGenericUxpRes.apk & SystemUI.apk in other folder.

that could be a problem with that apk, you cannot decompile it. If you have done all the steps properly as you said can you try with any other apk? :) so to be sure if that's the problem with that apk :)
 

Aciong.Aksaya

Senior Member
Aug 15, 2012
590
188
Mandaluyong
Ive been into that place if you knew david guetta face in the thread thats me. Thanks for your kindness to redirect me. The OP is not just very much accommodating geez...

I suggested you to install the proper framework files to decompile miui stuffs properly, though this thread is for compiling & decompiling with apk multi tool,not how to center clock on miui I beg your pardon? & I didn't say anything else because sandy already directed you to a guide, that's probably I would also gonna do If I were in the 1st place like sandy replied. You cannot say words which can hurt other people. Cause If I would know how to "Center clock on miui" I would open a thread with that guide,isn't it?

Hi Saqib Nazm, Yes it it but this is a full misunderstanding. The OP I am referring to is the OP on the link that Sandy gave.

Mea Culpa...
 

Saqib Nazm

Retired Forum Moderator / Inactive Recognized Them
Oct 3, 2012
2,889
7,753
Virginia, USA
Hi saqib i want to ask again. If I make own fragment in settings_header.xml. How?

Sent from my LT25i using xda premium

bro I have told you how to do it that day in the original thread, which part you didn't understand? You asked about smali files, you don't need any smali files man.
 

Saqib Nazm

Retired Forum Moderator / Inactive Recognized Them
Oct 3, 2012
2,889
7,753
Virginia, USA
Hi all members
I have some problem in recompiling apk files...
When i compile apk and delete resources.arsc+xmls that i have modified them,anything didnt change in apk ...
i am working on framework-res.apk ...
please helpe me...

what were you trying to change? & what you did?
 

Top Liked Posts

  • There are no posts matching your filters.
  • 33

    " This thread will cover various useful guides starting from how to Decompile/Recompile Apk & Jar files. Me & my friend Aneel will provide new guides/tutorial day by day so that you guys can get many handy guidance in one place. Please Suggest us If you need any guide & we will try to post it If we actually can. Also If you find our guides useful then support us my giving feedback, hitting thanks & adding in credits section "


    1st Let's start with [How to decompile & recompile with Apk Multitool]:

    *Requirements*

    Steps

    1. Unzip Apk Multi Tool into a folder
    2. Now run Setup.bat. It will look like this

    PRBujPT.png


    3. Now choose 3. Setup Directories & press enter
    4. This will create the folders needed. It will look like this

    rhUHjOm.png


    5. Now place the apk you want to decompile in place-apk-here-for-modding
    6. Place a framework-res.apk, SemcGenericUxpRes.apk & SystemUI.apk in other folder. Preferebly it should be from the same package of apk/same apks of a Rom which you placed in the place-apk-here-for-modding folder. If there is no corresponding apks then you can try with other framework & systemUI apks also.
    7. Now again run Setup.bat & press enter & choose 2. Installing Framework-Res. It will look like this

    Enx1oXC.png


    8. Now choose option 1 & enter to install framework & again option 4 & enter to install SystemUI
    9. Now run Script.bat & press enter to activate various menu. Choose option 9 to decompile the apk. Then press enter. It will look like this

    baj25eC.png


    10. Once decompile is complete close the script & go to projects folder
    11. Do the necessary changes you want to
    12. When editing is done again run Script.bat
    13. Choose option 11 to recompile & press enter. It will prompt a message after sometimes, Aside from the signatures....of errors (y/n)

    H8bI14u.png


    14. Input y & press enter
    15. Now after sometimes, it will again ask you to delete everything you have modified from keep folder & also delete resources.arsc if you have modified any xml. Minimize the script, delete the xml(s) you have modified (other than from values folder, it won't appear in keep folder) & also resources.arsc. If you have modified any png (not added) then delete it too. Then press enter when you are ready.

    ig324Ou.png


    16. Now your new apk is ready. You can find it in place-apk-here-for-modding folder. Note that, your original apk will also be in the same folder with original name. Your modified apk will have System_ attached in the name.

    17. Copy it to some other place & rename to original apk name & enjoy.
    18. When you want to work on the next project then delete everything from place-apk-here-for-modding & projects folder. Now follow the same steps again from Number 5 of this guide.


    [How to decompile & recompile Jar Files]:

    *Requirements*

    • Winrar/7zip
    • Deodexed Jar files
    • smali.jar
    • baksmali.jar (both are in the attachment)
    • Command Prompt/Terminal
    0. Take the classes.dex from jar file by opening it with 7zip/Winrar.
    1. Open a new folder in Desktop named suppose "Jar"
    2. Place smali.jar & baksmali.jar in the folder
    2. Open Command Prompt. On windows type cmd in Run
    3. cd to your directory where you have opened the new folder. In my case it is

    Code:
    C:\Documents and Settings\USER\Desktop\Jar
    4. Write
    Code:
    cd C:\Documents and Settings\USER\Desktop\Jar
    & press enter. Note that, on your case the directory will be different from mines. So get the correct directory by going into that directory from C:

    YMMyBaX.jpg


    5. Now type this to Decompile. Note that, there is a "space" before "classes.dex"


    Code:
    java -jar baksmali.jar -o classout\ classes.dex
    & press enter

    3d1H5mI.jpg


    6. When Decompiling is done there will a folder named "classout" be placed in Jar folder. Minimize the cmd.

    f6JIxBp.png


    7. Now make the necessary changes inside the classout folder
    8. When done,type this to recompile & press enter. Remember, there is a "space" before "new-classes.dex"


    Code:
    java -Xmx512M -jar smali.jar classout\ -o new-classes.dex


    9. When recompiling is done there will be a new file in the folder named "new-classes.dex"

    Lqrz6iD.png


    10. Now rename new-classes.dex to classes.dex & put it in the jar file with 7zip/Winrar


    ..............That's All. Thank You.................


    Credits:

    • @raziel23x for Apk Multitool
    • @iONEx for teaching me about Apk Multitool when I was a noob
    • @Hero for Decomping jar files concept
    3
    Ive been into that place if you knew david guetta face in the thread thats me. Thanks for your kindness to redirect me. The OP is not just very much accommodating geez...

    I suggested you to install the proper framework files to decompile miui stuffs properly, though this thread is for compiling & decompiling with apk multi tool,not how to center clock on miui I beg your pardon? & I didn't say anything else because sandy already directed you to a guide, that's probably I would also gonna do If I were in the 1st place like sandy replied. You cannot say words which can hurt other people. Cause If I would know how to "Center clock on miui" I would open a thread with that guide,isn't it?
    2
    Nice share... BTW, can mod MiuisystemUI.apk with this tool? I've heard Miui uses different aapt.
    2
    Nice share... BTW, can mod MiuisystemUI.apk with this tool? I've heard Miui uses different aapt.

    yes you can :) just follow this cause miui has more than one framework-res.apk & you don't need twframework in this case http://forum.xda-developers.com/showthread.php?t=2306397
    2
    Hell there is an error in your compiling code of your smali/jar

    it should be "-o new-classes.dex"
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone