Last active
April 11, 2023 23:12
-
-
Save searock/608dc09ba2f61fbd4d69a50c7d6c9f0b to your computer and use it in GitHub Desktop.
Modifing apk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Modifing the APK | |
This instructions are for mac | |
Make sure you have java installed and you can access it from the terminal. | |
Head to apktool website and download the apktool jar and apktool.sh | |
https://ibotpeaches.github.io/Apktool/install/ | |
Rename the jar to apktool.jar | |
Rename the apktool shell file to apktool | |
Move both the files to /usr/local/bin | |
sudo cp apktool.jar /usr/local/bin | |
sudo cp apktool /usr/local/bin | |
Permission to run | |
sudo chmod +x /usr/local/bin/apktool | |
Test the command on the terminal by typing apktool | |
For this example let's say we have test.apk | |
Decompile the apk using | |
apktool d test.apk | |
You should see a folder with the code. | |
Once you are done modifying compile it to apk again. | |
apktool b test | |
apktool b test/ -o test_unaligned.apk | |
Zipalign the zpk. You will need to move it to sdk/build-tools/buildtoolversion or add this to your path | |
cp test.apk sdk/build-tools/31.0.0 | |
./zipalign -p -f 4 test_unaligned.apk test.apk | |
Now we need to create a keystore for sigining our apk. | |
keytool -genkey -v -keystore key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias <your-alias> | |
for example | |
keytool -genkey -v -keystore test.keystore -keyalg RSA -keysize 2048 -validity 10000 -alias sam | |
copy it to sdk/build-tools/buildtoolversion | |
cp test.keystore sdk/build-tools/31.0.0 | |
then sign the apk | |
./apksigner sign --ks test.keystore test.apk |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment