What is the command to list the available avdnames

2020-05-11 11:40发布

问题:

I know I can start the emulator avd by typing

emulator.exe @avdname

But is there a command to list the available avdnames? Where are this avd configuration stored?

回答1:

AFAIK android list avd avdmanager list avd is what you need.



回答2:

Using sdk/tools/emulator

This will list all available avds

emulator -list-avds


回答3:

List all your emulators:

emulator -list-avds

Run one of the listed emulators:

emulator @name-of-your-emulator

where emulator is under:

${ANDROID_SDK}/tools/emulator



回答4:

get into Android/sdk/tools and run following command

./emulator -list-avds

which will return something like

Nexus_5X_API_P
Nexus_6_API_25


回答5:

I try few combination and it worked :), it was pretty obvious

android list avd

the output is something like this

Available Android Virtual Devices:
    Name: EMULLL
    Path: /home/krste_ristevski/.android/avd/EMULLL.avd
  Target: Android 2.3.3 (API level 10)
    Skin: WVGA800
  Sdcard: 512M

now with

emulator @EMULLL

I can start the emulator from console



回答6:

This is an old post, but I am currently using this script to display the avd names and start one.

#! /bin/bash
# (@) start-android
# If the emulator command exists on this device, displays a list of emulators
# and prompts the user to start one

# Check if the emulator command exists first
if ! type emulator > /dev/null; then
  echo "emulator command not found"
  exit 1
fi

# Gather emulators that exist on this computer
DEVICES=( $(emulator -list-avds 2>&1 ) )

# Display list of emulators
echo "Available Emulators
----------------------------------------"
N=1
for DEVICE in ${DEVICES[@]}
do
  echo "$N) $DEVICE"
  let N=$N+1
done

# Request an emulator to start
read -p "
Choose an emulator: " num

# If the input is valid, launch our emulator on a separate PID and exit
if [ $num -lt $N ] && [ $num -gt 0 ];
then
  DEVICE=${DEVICES[$num-1]}
  emulator "@$DEVICE" > /dev/null 2>&1 &
  exit 0
else
  echo "Invalid Entry : $num"
  exit 1
fi

Here is an example run and output:

./start-android.sh
Available Emulators
----------------------------------------
1) Nexus_5X_API_23
2) Nexus_9_API_23

Choose an emulator: 1


回答7:

I have a simple method (Only for windows):

  1. First of all set permanent path to adb in your system (Pretty similar like java). Find yours, For most of cases - C:\Program Files\android\android-sdk\platform-tools and copy it. Now go through your system properties and find Advance System Setting. Now find Environment Variable, in system variable tab find path. If there is no path then create a new variable and name it Path and paste the copied value in next field. But if there is already a Path, then open it and put a ; semi-colon at the last of value box and paste the copied value.

  2. Now you are almost done.! Check it by typing adb in cmd

  3. and now type adb devices, thats what you wanted. Cheers.!



回答8:

For Mac users arriving here, you can find the previously mentioned android/sdk/tools directory at /Users/YOURUSERNAME/Library/Android/sdk/tools/