正如How to create Android Virtual Device with command line and avdmanager?中指出的
原则上可以从命令行创建AVD。虽然不是那么简单。在文档之后,应该有一个-t选项,该选项通过指定targetId来指定要模拟的特定设备。
不幸的是,从25.3.1版本开始,avdmanager无法识别选项-t
有一个--tag选项,但它似乎不是等效的-t,因为它无法识别提供的targetId(从列表中获取)。
如何指定要模拟的设备?

最佳答案

例如echo "no" | avdmanager --verbose create avd --force --name x86 --device "4in WVGA (Nexus S)" --package "system-images;android-24;google_apis;x86" --tag "google_apis" --abi "x86"
在哪里:

Usage:
      avdmanager [global options] create avd [action options]
      Global options:
  -s --silent     : Silent mode, shows errors only.
  -v --verbose    : Verbose mode, shows errors, warnings and all messages.
     --clear-cache: Clear the SDK Manager repository manifest cache.
  -h --help       : Help on a specific command.

Action "create avd":
  Creates a new Android Virtual Device.
Options:
  -a --snapshot: Place a snapshots file in the AVD, to enable persistence.
  -c --sdcard  : Path to a shared SD card image, or size of a new sdcard for
                 the new AVD.
  -g --tag     : The sys-img tag to use for the AVD. The default is to
                 auto-select if the platform has only one tag for its system
                 images.
  -p --path    : Directory where the new AVD will be created.
  -k --package : Package path of the system image for this AVD (e.g.
                 'system-images;android-19;google_apis;x86'). [required]
  -n --name    : Name of the new AVD. [required]
  -f --force   : Forces creation (overwrites an existing AVD)
  -b --abi     : The ABI to use for the AVD. The default is to auto-select the
                 ABI if the platform has only one ABI for its system images.
  -d --device  : The optional device definition to use. Can be a device index
                 or id.

关于android - 如何使用avdmanager从命令行安装特定的模拟器?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/42966496/

10-11 19:26