列出可用 avdname 的命令是什么

发布于 2024-12-11 13:11:19 字数 121 浏览 0 评论 0原文

我知道我可以通过键入启动模拟器 avd

emulator.exe @avdname

但是是否有命令列出可用的 avdnames? 这个 avd 配置存储在哪里?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(10

温折酒 2024-12-18 13:11:19

使用 sdk/tools/emulator

这将列出所有可用的 avd

emulator -list-avds

Using sdk/tools/emulator

This will list all available avds

emulator -list-avds
久隐师 2024-12-18 13:11:19

AFAIK avdmanager list avd 就是您所需要的。

AFAIK avdmanager list avd is what you need.

乞讨 2024-12-18 13:11:19

进入 Android/sdk/tools 并运行以下命令,

./emulator -list-avds

该命令将返回类似的内容

Nexus_5X_API_P
Nexus_6_API_25

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
把梦留给海 2024-12-18 13:11:19

列出所有模拟器:

模拟器-list-avds

运行列出的模拟器之一:

模拟器@name-of-your-emulator

,其中模拟器位于:

${ANDROID_SDK}/tools/emulator

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

南冥有猫 2024-12-18 13:11:19

我尝试了一些组合,它起作用了:),很明显,

android list avd

输出

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

现在

emulator @EMULLL

是这样的,我可以从控制台启动模拟器

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

鼻尖触碰 2024-12-18 13:11:19

这是一篇旧帖子,但我目前正在使用此脚本来显示 avd 名称并启动一个。

#!/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 | grep -v "INFO"))

# 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 [ -n "$num" ] && [ "$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

这是运行和输出的示例:

./start-android.sh
Available Emulators
----------------------------------------
1) Nexus_5X_API_23
2) Nexus_9_API_23
 
Choose an emulator: 1

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 | grep -v "INFO"))

# 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 [ -n "$num" ] && [ "$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
屋顶上的小猫咪 2024-12-18 13:11:19

在 Mac 和 Linux 操作系统上:

  1. 导航到 Android/sdk/emulators
  2. 运行命令 ./emulator -list-avds

这将为您提供在系统上创建的所有 avd。

On Mac and Linux operating system:

  1. Navigate to Android/sdk/emulators
  2. Run command ./emulator -list-avds

This will give you all the avd's created on your system.

绳情 2024-12-18 13:11:19

我有一个简单的方法(仅适用于 Windows):

  1. 首先在系统中设置 adb 的永久路径(与 java 非常相似)。找到你的,对于大多数情况 - C:\Program Files\android\android-sdk\platform-tools 并复制它。现在浏览您的系统属性并找到高级系统设置。现在找到环境变量,在系统变量选项卡中找到路径。如果没有路径,则创建一个新变量并将其命名为 Path 并将复制的值粘贴到下一个字段中。但是如果已经有一个 Path,则打开它并在值框的最后放置一个 ; 分号并粘贴复制的值。

  2. 现在你就快完成了。!在cmd中输入adb来检查它

  3. ,然后输入 adb devices,这就是您想要的。干杯。!

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.!

仲春光 2024-12-18 13:11:19

首先检查模拟器 exe 是否已安装并且存在于 PATH 环境变量中:

Windows:
模拟器所在

C:\Users\ShahidSiddiqui>where emulator
C:\Users\ShahidSiddiqui\AppData\Local\Android\Sdk\emulator\emulator.exe

*nix/Mac:
哪个模拟器

如果找不到模拟器,请安装它或修复 PATH 以包含其路径。

您可以通过运行命令来检查 PC 中是否存在 AVD:

PS C:\Users\ShahidSiddiqui> dir $HOME\.android\avd


    Directory: C:\Users\ShahidSiddiqui\.android\avd


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----         7/05/2021   2:55 pm                Copy_of_HighRAM_Custom_API_30-Clone.avd
d-----        27/04/2021   5:36 pm                HighRAM_Custom_API_30.avd
d-----        29/01/2021  10:19 pm                Nexus_5X_API_30.avd
d-----        30/03/2021   1:27 pm                Nexus_5X_API_30_2.avd
d-----        22/01/2021   8:03 am                Pixel_4_API_30.avd
d-----        24/12/2020  10:14 am                Pixel_4_API_30_-2.avd
d-----        18/03/2021   2:55 pm                ShahidDevice_API_30.avd
-a----        29/04/2021  10:00 am            176 HighRAM_Custom_API_30-Clone.ini
-a----        29/01/2021   4:36 pm            148 HighRAM_Custom_API_30.ini
-a----        25/03/2021   4:20 pm            140 Nexus_5X_API_30_-New.ini

INI 文件是您可以运行的 AVD 的名称。

如果您配置正确,那么查看 AVD 就非常容易了。运行命令:

PS C:\Users\ShahidSiddiqui> emulator -list-avds
HighRAM_Custom_API_30-Clone
HighRAM_Custom_API_30
Nexus_5X_API_30_-New

要启动这些 avd 中的任何一个,请运行命令(我正在使用它):

PS C:\Users\ShahidSiddiqui\.android\avd> emulator -avd HighRAM_Custom_API_30-Clone
emulator: Android emulator version 30.5.5.0 (build_id 7285888) (CL:N/A)
handleCpuAcceleration: feature check for hvf
added library vulkan-1.dll
Failed to open /qemu.conf, err: 2
Windows Hypervisor Platform accelerator is operational
emulator: INFO: GrpcServices.cpp:301: Started GRPC server at 127.0.0.1:8554, security: Local

然后将启动一个甜蜜的 AVD。
干杯!

注意:adb devices 命令只会列出当前运行的 avds 和真实的 Android 设备。它不会显示模拟器(即配置的 avds)。

First check if the emulator exe is installed and is present in the PATH env variable:

Windows:
where emulator

C:\Users\ShahidSiddiqui>where emulator
C:\Users\ShahidSiddiqui\AppData\Local\Android\Sdk\emulator\emulator.exe

*nix/Mac:
which emulator

If no emulator found, either install it or fix the PATH to include its path.

You can check for the avd's present in your PC by running command:

PS C:\Users\ShahidSiddiqui> dir $HOME\.android\avd


    Directory: C:\Users\ShahidSiddiqui\.android\avd


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----         7/05/2021   2:55 pm                Copy_of_HighRAM_Custom_API_30-Clone.avd
d-----        27/04/2021   5:36 pm                HighRAM_Custom_API_30.avd
d-----        29/01/2021  10:19 pm                Nexus_5X_API_30.avd
d-----        30/03/2021   1:27 pm                Nexus_5X_API_30_2.avd
d-----        22/01/2021   8:03 am                Pixel_4_API_30.avd
d-----        24/12/2020  10:14 am                Pixel_4_API_30_-2.avd
d-----        18/03/2021   2:55 pm                ShahidDevice_API_30.avd
-a----        29/04/2021  10:00 am            176 HighRAM_Custom_API_30-Clone.ini
-a----        29/01/2021   4:36 pm            148 HighRAM_Custom_API_30.ini
-a----        25/03/2021   4:20 pm            140 Nexus_5X_API_30_-New.ini

The INI files are the name of the AVDs that you can run.

If you have configured things properly, looking the AVDs is quite easy. Run command:

PS C:\Users\ShahidSiddiqui> emulator -list-avds
HighRAM_Custom_API_30-Clone
HighRAM_Custom_API_30
Nexus_5X_API_30_-New

To launch any of these avds, run the command (I am using which I am working on it):

PS C:\Users\ShahidSiddiqui\.android\avd> emulator -avd HighRAM_Custom_API_30-Clone
emulator: Android emulator version 30.5.5.0 (build_id 7285888) (CL:N/A)
handleCpuAcceleration: feature check for hvf
added library vulkan-1.dll
Failed to open /qemu.conf, err: 2
Windows Hypervisor Platform accelerator is operational
emulator: INFO: GrpcServices.cpp:301: Started GRPC server at 127.0.0.1:8554, security: Local

And a sweet AVD will be launched.
Cheers!

NOTE: adb devices command will only list the currently running avds and real android devices. It will not show emulators (i.e. avds configured).

柏拉图鍀咏恒 2024-12-18 13:11:19

对于到达此处的 Mac 用户,您可以在 /Users/YOURUSERNAME/Library/Android/sdk/tools/ 找到前面提到的 android/sdk/tools 目录

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文