ANDROID_HOME环境变量设置正确且有效,我能够使用“离子构建android”从终端本地构建android项目但是当我从Jenkins开始构建时,我得到以下错误(这是来自jenkins的日志安慰)。我还设置了管理jenkins的环境变量 - >配置系统 - >环境变量。
+ ionic build android
WARN: ionic.project has been renamed to ionic.config.json, please rename it.
You have been opted out of telemetry. To change this, run: cordova telemetry on.
Using this version of Cordova with older version of cordova-android is being deprecated. Consider upgrading to cordova-android@5.0.0 or newer.
Running command: /Users/Shared/Jenkins/Home/jobs/csgtools/workspace/hooks/after_prepare/010_add_platform_class.js /Users/Shared/Jenkins/Home/jobs/csgtools/workspace
add to body class: platform-android
will push strings array {"name":"lang","titles":["English (US)","English (UK)"],"values":["en-us","en-gb"]}
android preferences file was successfully generated
Running command: /Users/Shared/Jenkins/Home/jobs/csgtools/workspace/platforms/android/cordova/build
[1m[Error: 'ANDROID_HOME' environment variable is set to non-existent path: /Users/prakash/Library/Android/sdk
Try update it manually to point to valid SDK directory.]
[22m [1mError:/Users/Shared/Jenkins/Home/jobs/csgtools/workspace/platforms/android/cordova/build: Command failed with exit code 2[22m
[1m
[22m
Finished: SUCCESS
这是我在jenkins中的shell构建脚本:
export PATH="$PATH:/usr/local/bin"
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
cd $WORKSPACE
echo $PATH
chmod -R 777 *
ionic build android