Bitrise构建Android项目时sips命令找不到问题求助
sips command not work on Bitrise for Android builds? The root cause here is straightforward: sips is a macOS-only command-line utility designed for image and icon manipulation. Bitrise's default build environment for Android projects uses Linux-based virtual machines (typically Ubuntu), and Linux systems don't include the sips tool at all—hence the "command not found" error you're seeing.
Your local setup works perfectly because you're running the script on a macOS machine, where sips comes pre-installed with the operating system.
Here are two solid solutions to fix this:
Switch to a macOS build machine on Bitrise
If you want to keep using your existingsipsscript without modifications, you can configure your Bitrise workflow to use a macOS-based runner instead of Linux. Keep in mind that macOS build machines usually cost more in terms of build minutes and have higher resource overhead compared to Linux runners, but Android builds do work perfectly fine on macOS.Replace
sipswith a cross-platform image tool
A more cost-effective and future-proof approach is to swap outsipsfor a cross-platform alternative like ImageMagick, which supports Linux, macOS, and Windows. Here's how to set this up on Bitrise:- Add a new "Script" step early in your workflow to install ImageMagick on the Linux runner:
apt-get update && apt-get install -y imagemagick - Rewrite the image resizing commands in your script to use ImageMagick's
converttool. For example:- Original
sipscommand:sips -z 108 108 input.png --out output.png - Equivalent ImageMagick command:
convert input.png -resize 108x108! output.png
The!flag ensures the image is forced to the exact dimensions (instead of scaling proportionally), matching the behavior ofsipsin this case.
- Original
- Add a new "Script" step early in your workflow to install ImageMagick on the Linux runner:
内容的提问来源于stack exchange,提问作者omri tal

