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

Saqib Nazm

Retired Forum Moderator / Inactive Recognized Them
Oct 3, 2012
2,889
7,753
0
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



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



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



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



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)



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.



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:



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



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



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"



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

Last edited:

vishal_android freak

Inactive Recognized Developer / Recognized Contrib
Dec 30, 2012
1,898
5,637
0
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
0
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
0
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.





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





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





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
0
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
0
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
0
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
0
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?