15

I already have a release unsigned version apk and I am trying to sign it on my mac. On the last step it suggests to zipalign the signed apk but mac doesn't have zipalign.

I did 'brew search ' still can't find it. I searched online and can't find standalone zipalign script. I even downloaded around 90M Android sdk tool from http://developer.android.com/sdk/index.html#Other but still found no zipalign inside.

So my question is, given you an "apk" file to sign on mac, how to get through the last "zipalign" step?

4

2 回答 2

33

感谢 RC 提供的信息。

我终于熬过去了。我做了以下步骤:

  1. 从官方网站下载 250M+ android studio ide dmg。将其拖入应用程序文件夹
  2. 打开它,它会自动下载很多额外的东西
  3. 我什至创建了一个空的新项目。

然后在某个步骤(我不确定是哪一步)它在这里创建了 zipalign:

~/Library/Android/sdk/build-tools/22.0.1/zipalign

如果只需要“zipalign”,则不需要重做那些步骤,这需要时间和磁盘空间。我把它提取到了github(不敢相信没有人提取它-_-):

https://github.com/catccaatt/zipalign

于 2015-05-02T07:21:04.737 回答
15

从您的 Mac 终端:

将 adb 添加到命令行路径:

echo 'export ANDROID_HOME=/Users/$USER/Library/Android/sdk' >> ~/.bash_profile

将构建工具添加到命令行路径:

echo 'export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/build-tools/28.0.2' >> ~/.bash_profile

刷新命令行:

source ~/.bash_profile

然后你可以运行它:

zipalign -v -p 4 my-app-unsigned.apk my-app-unsigned-aligned.apk
于 2018-09-20T10:34:20.713 回答