Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 38 You must be signed in to star a gist
  • Fork 8 You must be signed in to fork a gist
  • Save ryanamaral/fb5dddf5c4fad39543b7133c8f8e88da to your computer and use it in GitHub Desktop.
Save ryanamaral/fb5dddf5c4fad39543b7133c8f8e88da to your computer and use it in GitHub Desktop.
1. Download latest apktool version.
2. Download the batch file and aapt.exe.
3. Create a folder anywhere in the PC and put all the apktool.jar, aapt.exe and the batch script in that folder.
4. Open command prompt.
5. Navigate to the folder where you placed apktool.jar, batch script and the aapt.exe.
6. Now, you need to install the file using the " IF " command.
7. Type the following command.
apktool if name-of-the-app.apk
8. For decompiling use the command "d". The "d" stands for decompile.
apktool d name-of-the-app.apk
9. After the app is correctly decompiled, a new folder will be created in the same folder where you placed your app. This contains all the xml's and smali files which can be edited for different mode's.
10. To recompile the app use the following command " B ". The "b" simply means recompile.
apktool b name-of-the-app-folder
11. The final modded app will be in the "dist" folder located inside the original app folder created by apktool.
Signing the apk
1. open a new command prompt and change into the sign-apk directory using cmd
2. move the modified-unsigned apk into this folder
3. then type the following command -
java -jar signapk.jar certificate.pem key.pk8 path-of-the-folder-contaning-the-apk.apk path-of-the-new-signed-apk.apk
4. Once compiled, the signed apk will be found in the same folder.
@kareem123123
Copy link

GREAT JOB

@ccwq
Copy link

ccwq commented Sep 3, 2022

Very good tutorial, I follow these operations down, no problem at all

@swablueme
Copy link

thankyou
I LOVE IT

@ugnius-s
Copy link

An alternative tool for signing: https://github.com/patrickfav/uber-apk-signer this will use latest algorithms.

@mon231
Copy link

mon231 commented Apr 11, 2023

You can simply use buildapp utility (pip install buildapp) which uses the newer method:
buildapp -d <sources_folder> -o <outout_apk>

@xuancong84
Copy link

You can simply use buildapp utility (pip install buildapp) which uses the newer method: buildapp -d <sources_folder> -o <outout_apk>

When I run buildapp, it displays the following:

Executing `apktool b base -o mod.apk_prealign`

So buildapp invokes apktool, it is just a wrapper, not very useful.

@VikramBetterOpinions
Copy link

VikramBetterOpinions commented Dec 11, 2023

For me buildapp worked.

@Sailboat265
Copy link

Sailboat265 commented Jan 5, 2024

An alternative tool for signing: https://github.com/patrickfav/uber-apk-signer this will use latest algorithms.

Thank you for mentioning this useful tool!

@HarwinderSingh15
Copy link

i have my code converted my samlli code to sources folder. Changes done in sources folder. if i start recompiling .do i need to convert sources folder to smalli files or apktool will handle it
image

@agambondan
Copy link

How to edit the smali code?

@mon231
Copy link

mon231 commented Mar 2, 2024

@HarwinderSingh15 - Apktool only handles changes in smali code, not java sources.
@agambondan - Simply edit the '.smali' files in the 'smali_classes\d' folders. It just like editing .asm file, but using dalvik opcodes. Note for specs http://pallergabor.uw.hu/androidblog/dalvik_opcodes.html

Again, I'd recommend using buildapp tool to rebuild the smali, as it automates the process of recompile, zipalign and sign in the new singing-scheme + automates tools downloading for these task + has a github-action for workflows.
Note for repos under my user for references&examples of rebuilding apk, editing smali and using github automations.

NOTE to use these tools and methods for educational / legal purposes only!

@agambondan
Copy link

agambondan commented Mar 3, 2024

@HarwinderSingh15 - Apktool only handles changes in smali code, not java sources. @agambondan - Simply edit the '.smali' files in the 'smali_classes\d' folders. It just like editing .asm file, but using dalvik opcodes. Note for specs http://pallergabor.uw.hu/androidblog/dalvik_opcodes.html

Again, I'd recommend using buildapp tool to rebuild the smali, as it automates the process of recompile, zipalign and sign in the new singing-scheme + automates tools downloading for these task + has a github-action for workflows. Note for repos under my user for references&examples of rebuilding apk, editing smali and using github automations.

NOTE to use these tools and methods for educational / legal purposes only!

I asked GPT if it was hard to edit Canal files. Can I recompile from an edited Jadx decompiler file and build it into an apk?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment