问题描述
我已签署并打包了Xamarin应用程序
因此使用Visual Studio创建了APK文件.
如何在Windows中zipualign此文件?
推荐答案
确保您拥有 android sdk构建工具安装然后检查您的SDK安装的位置我是在C:\Program Files(x86)\Android\android-sdk\build-tools\23.0.1\zipalign中,您将在android构建工具中找到zipalign然后使用它所以:
C:\Program Files(x86)\Android\android-sdk\build-tools\23.0.1\zipalign -v 4 infile.apk outfile.apk
用法
对齐infile.apk并将其另存为Outfile.apk:
zipalign [-f] [-v] <alignment> infile.apk outfile.apk
确认现有的对齐.Apk:
zipalign -c -v <alignment> existing.apk
对齐是定义字节对齐边界的整数.这必须始终为4(提供32位对齐),否则它有效地无效.
标志:
-f:覆盖现有outfile.zip
-v:详细输出
-c:确认给定文件的对齐
从Windows输出(额外参数不在文档中: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
其他推荐答案
我花了很多几分钟搜索android命令行构建工具.他们无处可在Program Files目录中找到.显然,在我的系统上,工具在以下位置:
C:\Users\{username}\AppData\Local\Android\Sdk
我在Android Studio中找到了文件>项目结构> SDK位置.
编辑:显然,"我的系统"是Windows - 特别是Windows 10.
其他推荐答案
对于Windows 10将路径变量设置为
C:\Users\<NAME>\AppData\Local\Android\Sdk\build-tools\<version>
然后从应用程序存在的位置运行命令
zipalign -v 4 <YOUR_APP_NAME> app-release-final.apk
问题描述
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?
推荐答案
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] <alignment> infile.apk outfile.apk
To confirm the alignment of existing.apk:
zipalign -c -v <alignment> 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] <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
其他推荐答案
I spent a good few minutes searching for the Android command line build tools. They were nowhere to be found inside either of the Program Files directories. Apparently, on my system the tools were in the following location:
C:\Users\{username}\AppData\Local\Android\Sdk
I found the location inside Android Studio by going to File > Project Structure > SDK Location.
Edit: Obviously, "my system" is Windows - specifically Windows 10.
其他推荐答案
For windows 10 set PATH variable to
C:\Users\<NAME>\AppData\Local\Android\Sdk\build-tools\<version>
And then run the command from the location where application is present
zipalign -v 4 <YOUR_APP_NAME> app-release-final.apk