[How to] Decompile/Compile Android 4.1.2/4.2.2 jelly bean Apktool

[How to] Decompile/Compile Android 4.1.2/4.2.2 jelly bean Apktool

    

Hi , guys . I saw many guides about how to recompile / decompile apk but many of them ended with some error . In this post i will teach how to compile and decomplie , zip align , and to sign apks .



Some Basic knowledge -

1. Why to Decompile apk -  

Android files had extension of .apk which are made up of many java codes that can not be edited with out decompiling it . Decompiling is necessary to make roms , make apps , edit Systemui , framework and any app from android .

Download - 

1. Android SDK, you can download from here (this including Java)
2. Download Latest Apktool 4.2.2 (Including Sign & baksmali) from here 
3. Notepad++ for your tool editing xml/smali you can download from here

HOW TO - 

Note - this guide is only for windows users .


  1. Open CMD
  • Press shift and right click on mouse and select "open command window here"

  1. Steps -
  • Extract the apktool ( downloaded zip ) to C drive / any where
  • Now Copy your device Framework , Systemui and TWFramework   to the extracted apktool folder

Now First install device framework and System to apktool by typing this on cmd

apktool if framework-res.apk

apktool if twframework-res.apk

apktool if SystemUI.apk

  • Now we will decompile your file  for eg. Settings.apk
  • To decompile Settings.apk type this on cmd 

apktool d Settings.apk

  • Do the editing you want to do
  • Now to recompile the folder type this on cmd
apktool b -f -d Settings
  • Exit cmd
  • Get your apk from Settings > dist folder 


OPTIONAL-
  • Open original Settings.apk using Winrar or 7zip go to folder settings>dist, open semcmusic.apk using Winrar or 7zip

  • Drag & drop folder META-INF & Lib in original apk to Modified apk, set compression to store and click ok

to sign :

  • Move apk modified from folder semcmusic>dist to same folder with apktool 

  • Open Command Prompt (CMD) 


java -jar SignApk.jar testkey.x509.pem testkey.pk8 Setting.apk setting_signed.apk ( can be whatever name you give to your apk )
NOTE : Sign apk only for apps 3rd Party but you can use for system>app but not all apps

to zipalign :

  • Open Command Prompt (CMD) 

zipalign -fv 4 setting_signed.apk setting_signed_zipaligned.apk

0  :