在準備發佈我的Ionic Android 程式到 Google Play Store 前 需要使用 zipalign 來把這個 APK 優化。。。
可惜當我使用 zipalign 指令時。。
出現了以下的錯誤信息
“‘zipalign’ is not recognized as an internal or external command, operable program or batch file”
很多時候遇到 “‘xxx’ is not recognized as an internal or external command, operable program or batch file” 都是因為 “Environment Variable” 沒有設定好
我在想..像adb 這些 Android SDK的tools都可以用到..
所以應該不是 “Environment Variable” 的 Path的問題
做了一會research之後發現
原來zipalign.exe.不是儲存在我們android SDK tool 這個資料夾內。。
<span style="color: #008000;"><strong>"C:\Users\[Username]\AppData\Local\Android\sdk\tools" </strong></span>
而是在。。
<span style="color: #008000;"><strong>"C:\Users\[Username]\AppData\Local\Android\sdk\build-tools\[Build version]" </strong></span>
解決方法。。
把 zipalign 從 “build-tools“的資料夾內
複製到 “tools” 的資料夾內
之後便可以成功使用 zipalign 指令了
Hope you find it useful