首页 > 解决方案 > 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.

标签: androidxamarin.androidgoogle-playapkandroid-install-apk

解决方案


apksigner要求您zipalign在签署之前。jarsigner要求您zipalign在签署后。这记录在 zipalign 文档中


推荐阅读