Get the Android SDK with brew cask install android-sdk
.
It has a Java 8 dependency and tells you to install it with brew cask install homebrew/cask-versions/adoptopenjdk8
.
If you already have another newer version, you must set JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home
.
You now have emulator
, sdkmanager
and avdmanager
.
To save yourself the missing file warnings, touch .android/repositories.cfg
.
To make a test VM, run sdkmanager "system-images;android-30;google_apis;x86"
to get the base image.
You'll have to accept some licenses.
Then avdmanager create avd -n $base -k "system-images;android-30;google_apis;x86"
to add it to the device list as $base
.
From now on, setting ANDROID_EMULATOR_DEBUG=1
will be useful.
You'll also need to set ANDROID_SDK_ROOT=/usr/local/share/android-sdk
.
Get the SDK's platform tools with sdkmanager "platform-tools" "platforms;android-30"
.
Then run the emulator. If you run it with emulator
, it will fail in an opaique way.
Instead of running the version in $PATH
(shpuld be /usr/local/bin/emulator
), you must instead run $ANDROID_SDK_ROOT/emulator/emulator
.
Call it with -avd $base
and it will load up QEMU and run your device.