Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

apksigner, zipalign and jarsigner not working as expected

I have created a Xamarin Form application using Visual Studio 2017 in Windows 10 and archived the android application to APK file.

When I upload the APK to Google Play console to update my existing app, it says the APK is not signed. Then I used this command to sign the APK using the same certificate

apksigner sign --ks <KEYSTORE_FILE_NAME> --ks-key-alias <ALIAS_NAME> <APK_FILE_NAME>

When I try to upload the signed APK, it says the APK is not zipaligned. Then I used this command to zipalign

zipalign -f -v 4 <OLD_APK_FILE_NAME> <NEW_APK_FILE_NAME>

When I upload the zipaligned APK to console, it says the APK is not signed. After I sign using apksigner it says it is not zipaligned. I am keep on circulating in the same circle again and again.

Even after I zipalign the APK first and then sign, Same error messages are displaying again and again in same circle.

Even if I used jarsigner, the situation is same.

I followed the steps given here

https://developer.xamarin.com/guides/android/deployment,_testing,_and_metrics/publishing/signing-the-app-package/manually-signing-the-apk/

But the APK not getting uploaded. What am I doing wrong?

Please note this is not a duplicate question.


1 Answers

apksigner requires you to zipalign prior to signing. jarsigner requires you to zipalign after signing. This is documented in the zipalign docs.

like image 182
Nick Fortescue Avatar answered Dec 20 '25 09:12

Nick Fortescue



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!