With Java 11+, you do not use the sdkmanager
from tools
.
Instead, use cmdline-tools
.
Install the command line tools through Android Studio Preferences > Android SDK > SDK Tools
and install Android SDK Command-line Tools (latest).
Use Android Studio's packaged JDK.
export JAVA_HOME=/Applications/Android\ Studio.app/Contents/jre/Contents/Home/
Then accept the license.
yes | ~/Library/Android/sdk/cmdline-tools/latest/bin/sdkmanager --licenses
For ARM-based Macs you may need to install Rosetta 2.
softwareupdate --install-rosetta