Last active
March 31, 2024 10:51
-
-
Save masablo/7f4b9096f9a7194428dadb39952c546f to your computer and use it in GitHub Desktop.
How to make a signed .apk file
This file contains hidden or 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
# 1. install Android Studio from https://developer.android.com/studio/?hl=ja | |
# 2. add PATH for the Android SDK | |
cat << 'EOS' >> ~/.zshrc | |
export ANDROID_HOME=$HOME/Library/Android/sdk | |
export PATH=$PATH:$ANDROID_HOME/tools | |
export PATH=$PATH:$ANDROID_HOME/tools/bin | |
export PATH=$PATH:$ANDROID_HOME/platform-tools | |
export PATH=$PATH:$ANDROID_HOME/build-tools/29.0.3 | |
EOS | |
# 3. make a kestore file with keytool and check it | |
keytool -genkey -v -keystore ***.keystore -storepass *** -alias *** -keypass *** -keyalg RSA -validity 36500 | |
keytool -list -v -keystore ***.keystore -storepass *** | |
# 4. Sign a apk file with apksigner | |
cd ~/Downloads/app/testflight | |
apksigner sign --ks ***.keystore -v --v2-signing-enabled true --ks-key-alias *** --ks-pass pass:*** ***.apk | |
# 5. Check the both fingerprints are the same | |
keytool -list -v -keystore ***.keystore -storepass *** | |
keytool -printcert -jarfile ***.apk | |
----- | |
# 1. fix versionCode and | |
brew install apktool | |
which apktool # /usr/local/bin/apktool | |
apktool d hoge.apk | |
vi hoge/apktool.yml (# fix versionCode) | |
apktool b hoge/ -o hoge.apk | |
zipalign -v -p 4 hoge.apk hoge_aligned.apk | |
apksigner sign --ks ***.keystore -v --v2-signing-enabled true --ks-key-alias *** --ks-pass pass:*** hoge_aligned.apk | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment