How to zipalign the apk file in Windows

后端 未结 5 1364
挽巷
挽巷 2021-02-01 02:33

I have signed and packaged the Xamarin application
and so have created the apk file using Visual Studio.

How can I zipalign this file in Windows?

5条回答
  •  不思量自难忘°
    2021-02-01 02:59

    Make sure you have the Android SDK build-Tools installed then check where your SDK is installed mine was at C:\Program Files(x86)\Android\android-sdk\build-tools\23.0.1\zipalign You will find zipAlign in the android build tools then use it like so:

    C:\Program Files(x86)\Android\android-sdk\build-tools\23.0.1\zipalign -v 4 infile.apk outfile.apk

    Usage

    To align infile.apk and save it as outfile.apk:

    zipalign [-f] [-v] infile.apk outfile.apk

    To confirm the alignment of existing.apk:

    zipalign -c -v existing.apk

    The alignment is an integer that defines the byte-alignment boundaries. This must always be 4 (which provides 32-bit alignment) or else it effectively does nothing.

    Flags:

    -f : overwrite existing outfile.zip

    -v : verbose output

    -c : confirm the alignment of the given file

    output from windows (extra parameters not in the Docs :O) :

    Zip alignment utility
    Copyright (C) 2009 The Android Open Source Project
    
    Usage: zipalign [-f] [-p] [-v] [-z]  infile.zip outfile.zip
           zipalign -c [-v]  infile.zip
    
    : alignment in bytes, e.g. '4' provides 32-bit alignment
    -c: check alignment only (does not modify file)
    -f: overwrite existing outfile.zip
    -p: page align stored shared object files
    -v: verbose output
    -z: recompress using Zopfli
    

    ZipAlign Docs

提交回复
热议问题