18

I am currently developing a mobile web application and I don't have a test device yet so I'm using the to check the site. On my mac, I have installed the stand-alone Android SDK. Every time I want to use the AVD Manager, I have to execute the following on my terminal:

monitor

This command (being executed on the installed android sdk path) will open the Android Device Monitor and from here, I go to its menu bar and select Window Virtual Device Manager just to open the AVD Manager. So, is there a shortcut for that? I mean, i want to directly open the AVD manager via .

JN ERC
  • 295
  • 1
  • 3
  • 14

6 Answers6

58

I was able to open it from terminal with:

android avd

You may need to navigate to your SDK tools/ first. Here is reference I used: AVD Manager

  • 8
    The `android` command is deprecated https://developer.android.com/studio/tools/help/android.html says: "This tool is no longer supported. You should instead use Android Studio to create AVDs and create projects." – Ciro Santilli OurBigBook.com Jun 25 '16 at 17:32
  • 1
    use `avdmanager` or `sdkmanager`: >The "android" command is deprecated. For manual SDK, AVD, and project management, please use Android Studio. For command-line tools, use tools/bin/sdkmanager and tools/bin/avdmanager – Mando Sep 21 '18 at 20:47
21

Go to tools directory inside your android sdk like:

cd ~/Android/Sdk/tools

and enter run your avd as

./emulator -avd <your-avd>

You can find your avd name by running:

./emulator -list-avds
Krishan Kumar Mourya
  • 2,207
  • 3
  • 26
  • 31
5

You can start emulator use terminal shell

emulator -avd <avd_name> [<options>]

options can be special -http-proxy, -dns-server setting. Get more options here

And to list all avd you can use:

emulator -list-avds

result like following:

4.7_WXGA_API_23
Nexus_5X_Edited_API_23

Example when I start Nexus_5X_Edited_API_23 emulator in OS X 10.11 with proxy setting

~/Library/Android/sdk/tools/emulator -netdelay none -netspeed full -avd Nexus_5X_Edited_API_23 -http-proxy http://username:password@local_server:8080
larva
  • 4,687
  • 1
  • 24
  • 44
3

this is just a small addon to previous solutions presented. What is probably handy to do is to just jam this as a alias into your bash_profile like so:

Open your bash_profile:

nano ~/.bash_profile

Add this:

alias avd='cd /path-to-sdk/tools; ./android avd'

Source it again:

source ~/.bash_profile

In the CLI type:

avd

Now you can open up the AVD by just using avd in the command line. The only thing i haven't figured out how to make it stay alive after closing the terminal. Maybe somebody has tips on that.

kfwerf
  • 129
  • 3
  • To avoid running it from the terminal (and hence having a terminal window), create a script file in the tools folder, say avd.sh, make it executable, with the contents "./android avd" (without the quotes of course). Only useful if running from a file browser or your menu though. – cartland Feb 10 '15 at 07:05
  • 2
    To run from the terminal then close the terminal, use "nohup ./android avd" – cartland Feb 10 '15 at 07:29
  • use `avdmanager` or `sdkmanager`: >The "android" command is deprecated. For manual SDK, AVD, and project management, please use Android Studio. For command-line tools, use tools/bin/sdkmanager and tools/bin/avdmanager – Mando Sep 21 '18 at 20:48
2

Use the Android SDK Tools:

avdmanager

Or you can also start it by using the command below but it's deprecated though on newer version. Before executing it, make sure to export your Android SDK's tools directory in your ~/.bash_profile (i.e. export PATH="/Users/user/Software/android-sdk-macosx/tools:$PATH")

android avd

Old answer:

In order to open the manager on terminal, execute the following:

/usr/bin/java -Xmx256M -XstartOnFirstThread \
 -Dcom.android.sdkmanager.toolsdir=/path/of/android-sdk-macosx/tools \
 -classpath /path/of/android-sdk-macosx/tools/lib/sdkmanager.jar:/path/of/android-sdk-macosx/tools/lib/swtmenubar.jar:/path/of/android-sdk-macosx/tools/lib/x86_64/swt.jar \
 com.android.sdkmanager.Main avd
vvns
  • 3,548
  • 3
  • 41
  • 57
  • use `avdmanager` or `sdkmanager`: >The "android" command is deprecated. For manual SDK, AVD, and project management, please use Android Studio. For command-line tools, use tools/bin/sdkmanager and tools/bin/avdmanager – Mando Sep 21 '18 at 20:48
0
emulator -avd  <nameOfYourAvdEmulator>

Find the names of your emulators using avdmanager list avd:

avdmanager list avd
    Name: Nexus_5X_API_23_Android_6.0
  Device: Nexus 5X (Google)
    Path: /Users/edward3/.android/avd/Nexus_5X_API_23_Android_6.0.avd
  Target: Google APIs (Google Inc.)
          Based on: Android 6.0 (Marshmallow) Tag/ABI: google_apis/x86
    Skin: nexus_5x
  Sdcard: 512M

Add to your ~/.profile if missing:

# Add to your ~/.profile PATH to easily run emulator and avdmanager commands
export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools

# Create alias to run your favorite Android emulator
alias avd-run='emulator -avd  Nexus_5X_API_23_Android_6.0 &'

Open a new terminal or use source ~/.profile to reload changes made to your ~/.profile

Start your favorite emulator using the alias you created:

avd-run
Ed of the Mountain
  • 5,219
  • 4
  • 46
  • 54