1

How can I create a new AVD emulator for Mac OS.

I don't have Android Studio installed - would prefer not to.

Docs talk about a program avdmanager -but I don't have it.

I think that gets installed with a certain Android sdk tools version - but I'm not getting the option to upgrade in my sdkmanager

dashman
  • 2,858
  • 3
  • 29
  • 51
  • I had the same problem , after some searching i found it more simple to install Android Studio . if its an option for you i'm recommending you to install it. – Matan Shushan Jun 14 '18 at 19:58

2 Answers2

1

+1 on comment of Liberbon

just change the x86 to x86_64 if you are using 64 bit OS.

In my case this solved my issue, I am using Mac OS v10.14.6

0

Install the dependencies for Android development.

Make sure that these initial steps are done before you create AVD emulator.

# Install Java 8 and Android SDK
brew tap caskroom/versions
brew cask install adoptopenjdk/openjdk/adoptopenjdk8
brew cask install android-sdk

# Set environment variables
echo "export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)" >> ~/.bash_profile
echo "export ANDROID_HOME=/usr/local/share/android-sdk" >> ~/.bash_profile
source ~/.bash_profile

# Install all Android SDK packages
$ANDROID_HOME/tools/bin/sdkmanager "tools" "emulator" "platform-tools" "platforms;android-28" "build-tools;28.0.3" "extras;android;m2repository" "extras;google;m2repository"

Create Android Virtual Device via command line.

# Load image if it's missing (optional)
$ANDROID_HOME/tools/bin/sdkmanager "system-images;android-28;google_apis;x86_64"

# Create android emulator with avdmanager
$ANDROID_HOME/tools/bin/avdmanager create avd -n Emulator-Api28-Google -k "system-images;android-28;google_apis;x86_64"

References:

UPD:

  • 2020-05-21: Changed brew cask install java8 to brew cask install adoptopenjdk/openjdk/adoptopenjdk8.
  • 2020-05-21: Changed x86 to x86_64. Thanks @Bon Tobiel Blancia for advice.
liberborn
  • 177
  • 1
  • 7
  • Looks like not so easy anymore `Error: Cask 'java8' is unavailable: No Cask with this name exists.` – Mikko Ohtamaa May 18 '20 at 11:37
  • 1
    Unable to install java8 it's something related to the homebrew. https://stackoverflow.com/questions/55834845/unable-to-install-java8-with-homebrew Possible fix is: `brew cask install adoptopenjdk/openjdk/adoptopenjdk8`. Maybe it could even work with the latest java: `brew cask install java`. But I didn't give it a try. – liberborn May 21 '20 at 06:32