[GitLab CI] Android Daily Build Fail

今天發現在 GitLab 裡所有的 Android 專案 Daily Build 都失敗了

  • Gradle 錯誤訊息:
SDK location not found. Define location with sdk.dir in the
local.properties file or with an ANDROID_HOME environment variable.
  • 錯誤追蹤

SSH 進機器發現其實環境變數有設定 ANDROID_HOME 的路徑

瞎搞了一陣之後想起來把 GitLab Runner 放進了 User Agents 執行

卻沒有在 User Agents 的 plist 設定環境變數

所以 Android 的專案就無法建置

  • 解決方法

~/Library/LaunchAgents/gitlab.ci.runner.plist 把 Android SDK 的路徑加進環境變數

example:

<key>EnvironmentVariables</key>
<dict>
<key>ANDROID_HOME</key>
<string>/Users/USERNAME/Library/Android/sdk</string>
</dict>
Like what you read? Give Joe Chen a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.