I have an Ansible role that accepts Android SDK licenses and installs the build tools and platforms.
- 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"
It always worked when configuring in localhost, but now I'm trying to configure a remote Mac and it returns the following error:
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": []}
This error also occurs when trying to run any Gradle command.
When I enter the host manually via SSH and I run the same shell command, it works perfectly.