Compile, decompile and sign APK using Apktool utility

Download latest apktool version. Download the batch file and aapt.exe. Create a folder anywhere in the PC and put all the apktool.jar, aapt.exe and the batch script in that folder. Open command prompt. Navigate to the folder where you placed apktool.jar, batch script and the aapt.exe. Now, you need to install the file using the…


  • Download latest apktool version.
  • Download the batch file and aapt.exe.
  • Create a folder anywhere in the PC and put all the apktool.jar, aapt.exe and the batch script in that folder.
  • Open command prompt.
  • Navigate to the folder where you placed apktool.jar, batch script and the aapt.exe.
  • Now, you need to install the file using the ” IF ” command.
  • Type the following command.

[code lang=”bash”]
apktool if name-of-the-app.apk
[/code]

  • For decompiling use the command with option “d”. The “d” stands for decompile.

[code lang=”bash”]
apktool d name-of-the-app.apk
[/code]

  • On decompiled, a new folder will be created in the same folder where you placed your APK. This contains all the xml’s and smali files.
  • To recompile the APK use the following command . The “b” simply means recompile.

[code lang=”bash”]
apktool b name-of-the-app-folder
[/code]

  • The final APK will be in the “dist” folder located inside the original application folder created by apktool.

Signing the apk

  • Extract file in your PC.
  • Open a new command prompt and change path into the sign-apk directory using command prompt.
  • Move the modified-unsigned apk into this folder.
  • Type the following command

[code lang=”bash”]
java -jar signapk.jar certificate.pem key.pk8 path-of-the-folder-contaning-the-apk.apk path-of-the-new-signed-apk.apk
[/code]

  • The signed apk will be found in the same folder.

 


Leave a Reply