How do I ZipAlign?

Hello, I have build my app. I am targeting Android 6.0. I generated and signed an APK with the archive tool in Visual Studio. However, when I upload my apk, Google complains that it is not Zipaligned. They say there is a command line to do that, but when I try to run zipalign it says that it is not a recognized program. I have android studio installed on my windows 10 system. Is there an option in Xamarin for Visual Studio I need to set?

Best Answer

Answers

  • JonDouglasJonDouglas USXamarin Team, University, Developer Group Leader Xamurai

    @RobertPeterson.4041

    zipalign is a program that is shipped with the Android SDK. You can find it under the build-tools folder.

    It is highly advised that you use Visual Studio's Publishing feature to accomplish the complete signing and zipaligning process for you.

    You can find a tutorial on this here:

    https://developer.xamarin.com/guides/android/deployment,testing,_and_metrics/publishing_an_application/part_2-_signing_the_android_application_package/

  • Thank you! I was was uploading the wrong APK. I was uploading the APK that was above the signed APKs folder.

  • Jhelumi786Jhelumi786 Member ✭✭

    Hi,
    I'm having the similar issue about zipAlign. I can zipalign the distributed .apk file produced by "Andriod Archive Process". Could you please explain the steps about "how can zipalign the .apk files before or in the process of Distribution.
    Do I have to Archive first and go to the "abi-apks" folder and zipalign each apk file manually using command line and then run the Distribution process?
    Can something be added into the Post Build Events?
    Thanks in advance.

Sign In or Register to comment.