我有一个ansible角色,接受android sdk许可证并安装构建工具和平台。
- name: Accept SDK licences
shell: cd {{ android_home }}/cmdline-tools/tools/bin && yes | ./sdkmanager --licenses
- name: Install sdk build-tools and platform
shell: cd {{ android_home }}/cmdline-tools/tools/bin && yes | ./sdkmanager "build-tools;29.0.2" "platforms;android-29" "platform-tools" "platforms;android-28" "patcher;v4" "emulator"
在localhost中进行配置时,它始终有效,但现在我尝试配置远程mac,它返回以下错误:
TASK [android-studio : Accept SDK licences]************************************
fatal: [HOST-IP]: FAILED! => {"changed": true, "cmd": "cd ~/Library/Android/sdk/cmdline-tools/tools/bin && yes | ./sdkmanager --licenses", "delta": "0:00:00.025609", "end": "2020-09-04 08:24:50.366391", "msg": "non-zero return code", "rc": 1, "start": "2020-09-04 08:24:50.340782", "stderr": "No Java runtime present, requesting install.", "stderr_lines": ["No Java runtime present, requesting install."], "stdout": "", "stdout_lines": []}
尝试运行任何gradle命令时也会发生此错误。
当我通过ssh手动进入主机并运行相同的shell命令时,它工作得非常好。
暂无答案!
目前还没有任何答案,快来回答吧!