Skip to content

Commit 5ebd7c2

Browse files
committed
build: switched from jarsigner to apksigner
1 parent 06387a9 commit 5ebd7c2

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

scripts/sign_apk.sh

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,20 @@ 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=$(find $ANDROID_HOME/build-tools -name "apksigner" -print | head -n 1)
32+
$apksigner sign --ks android.jks --ks-key-alias activitywatch \
33+
--ks-pass env:JKS_STOREPASS --key-pass env:JKS_KEYPASS \
34+
$input
3035

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
36+
# Verify
37+
$apksigner verify $input
38+
39+
# Move to output destination
40+
mv $input $output

0 commit comments

Comments
 (0)