[Android Software Development] theDroidfanatic:
[HOW-TO][29/MAR] How to setup APKTool & Decompile, Recomile, Sign, and Zipalign APKs

Decompile, Recompile, Sign and Zipalign APKs

Since there aren't many tutorials out there on how to decompile, recompile, sign and zipalign the framework-res.apk, or other APK files, I decided to create one myself :)

Decompiling, editing, recompiling and signing It can yield a number of results, for example, you can edit the values, add custom images, fix some issues, or just go on an adventure :)

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

[WHAT YOU NEED]

1) A computer

2) The APK you want to edit

3) Latest Java Development Kit (JDK) (Download and Install with default settings http://www.java.com/en/download/index.jsp)

4) Some resource files, which I have bundled into on convenient zip, found here.

5) The Framework-res.apk from /system/framework

- In the case of it being an APK from an HTC based ROM, you will also need the com.htc,resources.apk, found in the same directory​

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

[STEPS]

- Initial Setup

- First download the zip from above, and extract the files, into C:\Android\APK

- Then, install the JDK from the link above, to the default location

- Then, go to Start, search for 'Environment,' and choose 'Edit Environment Variables for your Account.'

- Now, edit 'PATH,' and 'CLASSPATH.' (If you don't have them, just add them, and name them PATH and CLASSPATH)

- - For PATH, give this as the Variable Value: "C:\Program Files\Java\jdkXXX\bin;" (Without Quotes)(XXX is the JDK version you have)

- - For CLASSPATH, give this as the Variable Value: "C:\Program Files\Java\jdkXXX\jre\lib;" (Without Quotes)(XXX is the JDK version you have)

- Install the Framework:

- Now, move the framework-res.apk, and com.htc.resources.apk (If HTC), to C:\Android\APK

- Press shift, and right click in the folder, and open a command prompt window from the dropdown

- - Type in: "Apktool if framework-res.apk" (Without Quotes) And Press Enter

- - If it is an HTC ROM, Type in: "Apktool if com.htc.resources.apk" (Without Quotes) And Press Enter

- If this goes successfully, you can remove these two APKs from the folder

* NOTE: Everything above was ONE TIME ONLY *

- Decompiling the APK

- Now, copy the APK that you want to decmopile, to C:\Android\APK

- Open a command prompt window there

- Type in "Apktool d xxx.apk" (Without Quotes, and replace xxx with the APK name)

- Once this is done successfully, you will have a folder with the APK name in C:\Android\APK

- You can now make any edits you like

- Recompiling the APK

- Once you're done editing, go back to C:\Android\APK

- Open a command prompt window, and type in "Apktool b xxx"

(Without Quotes, and xxx is the name of the folder where the APK was extracted)

- Once this is done, the new APK can be found in C:\Android\APK\xxx\dist (xxx is name of folder where you extracted the APK)

- Signing, and Zipaligning

- Now, there are two ways to do this.

- - Either you install DSIXDA's kitchen, from here, and use that to Sign, and Zipalign

- - Or, you send me the APK, and I'll do it for you :)

* NOTE: Always Sign, THEN Zipalign *

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

[CREDITS]

1• Mwilky for teaching me all this

2• Floatshow for initial recompiling instructions :)

3• Fisha21 for helping out

​