dashman
dashman

Reputation: 3018

Nativescript - how to create a new AVD emulator on MacOS

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

Upvotes: 1

Views: 890

Answers (2)

liberborn
liberborn

Reputation: 185

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.

Upvotes: 0

Bon Tobiel Blancia
Bon Tobiel Blancia

Reputation: 11

+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

Upvotes: 1

Related Questions