Skip to content

Commit

Permalink
build: switched from jarsigner to apksigner
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBjare committed Sep 26, 2023
1 parent 06387a9 commit 5ebd7c2
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions scripts/sign_apk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,20 @@ if [ -z $JKS_KEYPASS ]; then
exit 1
fi

# Zipalign
zipalign=$(find $ANDROID_HOME/build-tools -name "zipalign" -print | head -n 1)
$zipalign -v 4 $input $input.new
mv $input.new $input

# Sign
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 \
-storepass $JKS_STOREPASS -keypass $JKS_KEYPASS \
-keystore android.jks $input activitywatch
jarsigner -verify $input
mv $input $output
# Using apksigner instead of jarsigner since API 30+: https://stackoverflow.com/a/69473649
apksigner=$(find $ANDROID_HOME/build-tools -name "apksigner" -print | head -n 1)
$apksigner sign --ks android.jks --ks-key-alias activitywatch \
--ks-pass env:JKS_STOREPASS --key-pass env:JKS_KEYPASS \
$input

zipalign=$(find $ANDROID_HOME/build-tools -name "zipalign" -print | head -n 1)
$zipalign -v 4 $output $output.new
mv $output.new $output
# Verify
$apksigner verify $input

# Move to output destination
mv $input $output

0 comments on commit 5ebd7c2

Please sign in to comment.