Skip to content

Commit 3c80023

Browse files
committed
build: switched from jarsigner to apksigner
1 parent 06387a9 commit 3c80023

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

scripts/sign_apk.sh

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,19 @@ if [ -z $JKS_KEYPASS ]; then
2121
exit 1
2222
fi
2323

24+
# Zipalign
25+
zipalign=$(find $ANDROID_HOME/build-tools -name "zipalign" -print | head -n 1)
26+
$zipalign -v 4 $input $input.new
27+
mv $input.new $input
28+
2429
# Sign
25-
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 \
26-
-storepass $JKS_STOREPASS -keypass $JKS_KEYPASS \
27-
-keystore android.jks $input activitywatch
28-
jarsigner -verify $input
29-
mv $input $output
30+
# Using apksigner instead of jarsigner since API 30+: https://stackoverflow.com/a/69473649
31+
apksigner sign --ks android.jks --ks-key-alias activitywatch \
32+
--ks-pass env:JKS_STOREPASS --key-pass env:JKS_KEYPASS \
33+
$input
3034

31-
zipalign=$(find $ANDROID_HOME/build-tools -name "zipalign" -print | head -n 1)
32-
$zipalign -v 4 $output $output.new
33-
mv $output.new $output
35+
# Verify
36+
apksigner verify $input
37+
38+
# Move to output destination
39+
mv $input $output

0 commit comments

Comments
 (0)