如何在 Windows 中压缩 apk 文件 [英] How to zipalign the apk file in Windows

查看:34
本文介绍了如何在 Windows 中压缩 apk 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经签署并打包了 Xamarin 应用程序
因此使用 Visual Studio 创建了 apk 文件.

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

如何在 Windows 中压缩对齐此文件?

How can I zipalign this file in Windows?

推荐答案

确保您已安装 Android SDK 构建工具,然后检查您的 SDK 安装位置我在 C:\Program Files(x86)\Android\android-sdk\build-tools\23.0.1\zipalign 你会在 android 构建工具中找到 zipAlign 然后像这样使用它:

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

用法

对齐infile.apk并保存为outfile.apk:

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

zipalign [-f] [-v] <对齐>infile.apk outfile.apk

确认现有.apk的对齐方式:

To confirm the alignment of existing.apk:

zipalign -c -v ;现有.apk

对齐是一个定义字节对齐边界的整数.这必须始终为 4(提供 32 位对齐),否则它实际上什么也不做.

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.

标志:

-f : 覆盖现有的 outfile.zip

-f : overwrite existing outfile.zip

-v : 详细输出

-c : 确认给定文件的对齐方式

-c : confirm the alignment of the given file

windows 的输出(文档中没有的额外参数:O):

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] <align> infile.zip outfile.zip
       zipalign -c [-v] <align> infile.zip

<align>: 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 文档

这篇关于如何在 Windows 中压缩 apk 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆