[Android General] ibanez7:
[TOOL GB/ICS/JB/KK] Decompile/Recompile apk & jar | Sign | Zipalign | Basic editing

hello everyone... I want to share the tool for editing apk, and making a slightly guide for decompile/recompile apk and basic editing xml/smali... and this guide and tool for Windows user...

REQUIREMENTS :

Download and Install on your computer

1. JDK here

2. 7zip here or Winrar (recommended) here

3. Notepad++ here

4. Android SDK for patch 9.png until Zipalign the apk here

5. Apktool & baksmali/smali + Signer for all GB/ICS/JB ROM here

6. Apktool & baksmali/smali + Signer for all GB/ICS/JB ROM v2 here

7. Apktool & baksmali/smali + Signer for all GB/ICS/JB/KK ROM v3 (4.4 Kitkat support/optimized) here

Save or extract apktool to folder directory :

Windows XP : C:\Document and Settings\folder your computer name\here

Windows 7 : C:\User\folder your computer name\here

CREDITS & BIG THANKS TO :

- Brut.all for apktool

- Team Reject for Quick baksmali/smali file

- Yorzua for Sign apk file

- Rizal Lovins for support me

- pantrif13

1. How to Decompile and Recompile *.jar file or classes.dex​

- Copy *.jar file to apktool folder (make sure is the same folder). for example : android.policy.jar

- Open android.policy.jar using Winrar or 7zip and extract classes.dex file

- Drag & drop classes.dex to Quick-Baksmali.cmd (decompile process)

Screenshot example for Baksmaling/decompile classes.dex using drag & drop method :

​

- wait and you will see a folder with the name "classout"

- now you can start editing smali file on classout folder (use Notepad++ for editing it)

- After editing is complete, Drag & drop classout folder to Quick-Smali.cmd (recompile process)

Screenshot example for Smaling/recompile classout folder using drag & drop method :

​

- After recompile is complete, there will be a file with a name "new-classes.dex"

- Open android.policy.jar using Winrar or 7zip

- Rename new-classes.dex to classes.dex, and Drag & drop to android.policy.jar with normal compression

- finally, push back android.policy.jar into the system your device. push manual using root explorer/similar application or make a flashable zip.

2. How to Decompile and Recompile *.apk file​

a. Copy framework-res.apk to apktool folder (make sure is the same folder).

(Attention : to edit other default apk on system/app like Contacts.apk, Phone.apk. MusicPlayer.apk etc.. needed framework 2. for example : twframework-res.apk)​

b. Copy other *.apk you want to edit to apktool folder. for example : GreenRockers.apk

c. Open Command Prompt.bat

d. Decompile and install framework

apktool if framework-res.apk
apktool d GreenRockers.apk

Screenshot example for installing framework and decompiling apk :

​

if your apk is Contacs.apk, Phone.apk, Camera.apk etc.. follow this guide :

apktool if framework-res.apk
apktool if twframework-res.apk
apktool d Settings.apk

Screenshot example for installing framework 2 and decompiling apk :

​

e. wait and you will see a folder with the name "GreenRockers or Settings"

f. now you can start editing png, xml, even smali file

g. After editing is complete, Now Recompile

apktool b -f -d GreenRockers

or

apktool b -f -d Settings

Screenshot example for decompiling dan recompiling apk :

​

h. After recompile is complete, go to GreenRockers or Settings folder, Open dist folder and open GreenRockers.apk or Settings.apk using Winrar/7zip

i. Open Original GreenRockers.apk or Settings.apk Using Winrar/7zip

j. Drag & drop META-INF folder and android.manifest.xml (if you not edit android.manifest.xml), also lib folder if there in Original GreenRockers.apk to Modified GreenRockers.apk or Modified Settings.apk on dist folder.

Screenshot example for Drag & drop META-INF folder etc :

​

k. Now Sign apk, example :

java -jar SignApk.jar testkey.x509.pem testkey.pk8 GreenRockers.apk GreenRockers_signed.apk

(Attention : Sign apk is only for 3rd Party apps, you can sign apk from system/app. but not all apk on system/app support)​

l. Rename GreenRockers_signed.apk to GreenRockers.apk

m. Zipalign the apk

zipalign -fv 4 GreenRockers.apk GreenRockers-new.apk

n. Rename GreenRockers-new.apk to GreenRockers.apk

o. finally, push back xxxxxx.apk into the system your device. push manual using root explorer/similar application or make a flashable zip.

3. How to Zipalign the *.apk​

1. Download and Install Android SDK (if you've downloaded, do not need to download again)

2. Go to C:\Program Files\Android\android-sdk\tools

3. Search + copy zipalign.exe and draw9patch.bat then paste in the c:\windows\here

4. Open cmd and typing this code (For example : Zipalign SystemUI.apk) :

zipalign -fv 4 SystemUI.apk SystemUI-new.apk