avdmanager
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
avdmanager
是一項指令列工具,可用於建立及管理
透過指令列執行 Android 虛擬裝置 (AVD)。AVD 可讓您定義
Android 手機、Wear OS 手錶或 Android TV 裝置的特性
。
如果您使用的是 Android Studio,則不需要使用這項工具
可以改為
透過 IDE 建立及管理 AVD。
avdmanager
工具包含在 Android SDK 指令列工具套件中
於
android_sdk/cmdline-tools/version/bin/avdmanager
。
語法
如要使用 avdmanager
,請使用下列語法:
avdmanager [global options] command [command options]
全域選項
表 1. 以下項目的全域選項清單:
avdmanager。
全域選項 |
說明
|
-s |--silent
|
靜音模式:系統僅會輸出錯誤。
|
-h |--help
|
使用說明。
|
-v |--verbose
|
詳細模式:列印錯誤、警告和重要訊息。
|
--clear cache
|
清除 SDK Manager 存放區資訊清單快取。
|
指令和指令選項
表 2. 指令和選項清單
avdmanager。
指令和選項 |
說明
|
create avd -n name -k "sdk_id" [-c
{path|size}] [-f] [-p path]
|
建立新的 AVD。您必須提供name指定要用於 AVD 的 SDK 套件 ID,方法是使用sdk_id目前以雙引號括住。
舉例來說,下列指令會建立名為 test 的 AVD
使用 x86 系統映像檔進行 API 級別 25:
avdmanager create avd -n test -k "system-images;android-25;google_apis;x86" 敬上
以下說明其他選項的用途:
-
-c {path|size} :SD 標準畫質的路徑
這個 AVD 的資訊卡圖片,或要建立的新 SD 卡映像檔大小
這個 AVD 以 KB 或 MB 表示,以 K 或
M 。例如 -c path/to/sdcard/ 或 -c 1000M
-
-f :強制建立 AVD。如果您符合以下情況,請使用這個選項
必須使用採用相同名稱的新 AVD 覆寫現有的 AVD。
-
-p path :要建立這個 AVD 檔案目錄的位置路徑。如果沒有指定
AVD 會建立在路徑中
~/.android/avd/ 。
|
delete avd -n name
|
刪除 AVD。您必須使用 name 指定 AVD。
|
move avd -n name [-p path] [-r
new-name]
|
移動或重新命名 AVD。您必須使用 name 指定 AVD。
以下說明其他選項的用量:
-
-p path :要建立這個 AVD 檔案所在目錄的絕對路徑如果
您未納入這個引數,系統就不會移動 AVD。如要重新命名既有的 AVD,可以選擇不要納入這個引數。
-
-r new-name :AVD 的新名稱
已重新命名
|
list [target|device|avd] [-c]
|
列出所有可用指定目標、裝置定義或 AVD。如果您不
請指定 target 、device 或 avd 。
avdmanager 會列出全部三個。加入 -c
引數,接收適用於指令碼的精簡輸出內容。此-c 如要同時列出三個選項,則無法同時使用引數引數。
|
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-07-27 (世界標準時間)。
[null,null,["上次更新時間:2025-07-27 (世界標準時間)。"],[],[],null,["# avdmanager\n\nThe `avdmanager` is a command-line tool that lets you create and manage\nAndroid Virtual Devices (AVDs) from the command line. An AVD lets you define the\ncharacteristics of an Android handset, Wear OS watch, or Android TV device\nthat you want to simulate in the Android Emulator.\n\nIf you're using Android Studio, then you don't need to use this tool and you\ncan instead\n[create and manage AVDs from the IDE](/studio/run/managing-avds).\n\nThe `avdmanager` tool is included in the Android SDK Command-Line Tools package\nat\n\u003cvar translate=\"no\"\u003eandroid_sdk\u003c/var\u003e`/cmdline-tools/`\u003cvar translate=\"no\"\u003eversion\u003c/var\u003e`/bin/avdmanager`.\n\nSyntax\n------\n\nTo use `avdmanager`, use the following syntax: \n\n```\navdmanager [global options] command [command options]\n```\n\n### Global options\n\n**Table 1.** List of global options for\navdmanager.\n\n| Global option | Description |\n|---------------------|-------------------------------------------------------------------------|\n| `-s` \\| `--silent` | Silent mode: only errors are printed out. |\n| `-h` \\| `--help` | Usage help. |\n| `-v` \\| `--verbose` | Verbose mode: errors, warnings, and informational messages are printed. |\n| `--clear cache` | Clear the SDK Manager repository manifest cache. |\n\n### Commands and command options\n\n**Table 2.** List of commands and options\nfor avdmanager.\n\n| Command and options | Description |\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `create avd -n `\u003cvar translate=\"no\"\u003ename\u003c/var\u003e` -k \"`\u003cvar translate=\"no\"\u003esdk_id\u003c/var\u003e`\" [-c {`\u003cvar translate=\"no\"\u003epath\u003c/var\u003e`|`\u003cvar translate=\"no\"\u003esize\u003c/var\u003e`}] [-f] [-p `\u003cvar translate=\"no\"\u003epath\u003c/var\u003e`]` | Create a new AVD. You must provide a \u003cvar translate=\"no\"\u003ename\u003c/var\u003e for the AVD and specify the ID of the SDK package to use for the AVD using \u003cvar translate=\"no\"\u003esdk_id\u003c/var\u003e wrapped in quotes. For example, the following command creates an AVD named `test` using the x86 system image for API level 25: ``` avdmanager create avd -n test -k \"system-images;android-25;google_apis;x86\" ``` The following describes the usages for the other options: - `-c {`\u003cvar translate=\"no\"\u003epath\u003c/var\u003e`|`\u003cvar translate=\"no\"\u003esize\u003c/var\u003e`}`: The path to the SD card image for this AVD or the size of a new SD card image to create for this AVD in KB or MB, denoted with `K` or `M`. For example, `-c path/to/sdcard/` or `-c 1000M`. - `-f`: Force creation of the AVD. Use this option if you need to overwrite an existing AVD with a new AVD using the same name. - `-p `\u003cvar translate=\"no\"\u003epath\u003c/var\u003e: Path to the location where the directory for this AVD's files will be created. If you don't specify a path, the AVD is created in `~/.android/avd/`. |\n| `delete avd -n `\u003cvar translate=\"no\"\u003ename\u003c/var\u003e | Delete an AVD. You must specify the AVD with \u003cvar translate=\"no\"\u003ename\u003c/var\u003e. |\n| `move avd -n `\u003cvar translate=\"no\"\u003ename\u003c/var\u003e` [-p `\u003cvar translate=\"no\"\u003epath\u003c/var\u003e`] [-r `\u003cvar translate=\"no\"\u003enew-name\u003c/var\u003e`]` | Move or rename an AVD. You must specify the AVD with \u003cvar translate=\"no\"\u003ename\u003c/var\u003e. The following describes the usages for the other options: - `-p `\u003cvar translate=\"no\"\u003epath\u003c/var\u003e: The absolute path to the location at which to create the directory where this AVD's files will be moved. If you don't include this argument, the AVD won't be moved. You might choose not to include this argument if you want to rename the AVD in place. - `-r `\u003cvar translate=\"no\"\u003enew-name\u003c/var\u003e: The new name of the AVD being renamed. |\n| `list [target|device|avd] [-c]` | List all available targets, device definitions, or AVDs. If you don't specify `target`, `device`, or `avd`, `avdmanager` lists all three. Include the `-c` argument to receive a compact output suitable for scripts. The `-c` argument is not available when listing all three options together. |"]]